From 578c06a6147042d4adcbac4d6066143f50eae89b Mon Sep 17 00:00:00 2001 From: alecps Date: Wed, 8 May 2024 18:21:24 -0400 Subject: [PATCH] make old freezer not readonly so that .meta files are created --- op-chain-ops/cmd/celo-dbmigrate/ancients.go | 2 +- op-chain-ops/cmd/celo-dbmigrate/main.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/op-chain-ops/cmd/celo-dbmigrate/ancients.go b/op-chain-ops/cmd/celo-dbmigrate/ancients.go index 47b5333335a90..10f3ade5dfd17 100644 --- a/op-chain-ops/cmd/celo-dbmigrate/ancients.go +++ b/op-chain-ops/cmd/celo-dbmigrate/ancients.go @@ -23,7 +23,7 @@ type RLPBlockRange struct { } func migrateAncientsDb(oldDBPath, newDBPath string, batchSize uint64) (uint64, error) { - oldFreezer, err := rawdb.NewChainFreezer(filepath.Join(oldDBPath, "ancient"), "", true) + oldFreezer, err := rawdb.NewChainFreezer(filepath.Join(oldDBPath, "ancient"), "", false) // TODO can't be readonly because we need the .meta files to be created if err != nil { return 0, fmt.Errorf("failed to open old freezer: %v", err) } diff --git a/op-chain-ops/cmd/celo-dbmigrate/main.go b/op-chain-ops/cmd/celo-dbmigrate/main.go index c5372b2f5a1b4..d52f4e7649322 100644 --- a/op-chain-ops/cmd/celo-dbmigrate/main.go +++ b/op-chain-ops/cmd/celo-dbmigrate/main.go @@ -13,7 +13,7 @@ import ( ) // How to run: -// go run main.go -oldDB /path/to/oldDB -newDB /path/to/newDB [-batchSize 1000] [-verbosity 3] [-clear-all] [-clear-nonAncients] +// go run ./op-chain-ops/cmd/celo-dbmigrate -oldDB /path/to/oldDB -newDB /path/to/newDB [-batchSize 1000] [-verbosity 3] [-clear-all] [-clear-nonAncients] // // This script will migrate block data from the old database to the new database // You can set the log level using the -verbosity flag @@ -68,12 +68,12 @@ func main() { log.Crit("Failed to migrate ancients database", "err", err) } - var numAncientsNonAncients uint64 - if numAncientsNonAncients, err = migrateNonAncientsDb(*oldDBPath, *newDBPath, numAncientsNew-1, *batchSize); err != nil { + var numNonAncients uint64 + if numNonAncients, err = migrateNonAncientsDb(*oldDBPath, *newDBPath, numAncientsNew-1, *batchSize); err != nil { log.Crit("Failed to migrate non-ancients database", "err", err) } - log.Info("Migration Completed", "migratedAncients", numAncientsNew, "migratedNonAncients", numAncientsNonAncients) + log.Info("Migration Completed", "migratedAncients", numAncientsNew, "migratedNonAncients", numNonAncients) } func migrateNonAncientsDb(oldDbPath, newDbPath string, lastAncientBlock, batchSize uint64) (uint64, error) {