Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration script gap in migrated blocks #189

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-chain-ops/cmd/celo-migrate/ancients.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func migrateAncientsDb(oldDBPath, newDBPath string, batchSize, bufferSize uint64
return numAncientsNewBefore, numAncientsNewBefore, nil
}

log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize)
log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld-1, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize)

g, ctx := errgroup.WithContext(context.Background())
readChan := make(chan RLPBlockRange, bufferSize)
Expand Down
5 changes: 3 additions & 2 deletions op-chain-ops/cmd/celo-migrate/non-ancients.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui
// get the last block number
hash := rawdb.ReadHeadHeaderHash(newDB)
lastBlock := *rawdb.ReadHeaderNumber(newDB, hash)
lastAncient := numAncients - 1

log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-numAncients, "lastAncientBlock", numAncients)
log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-lastAncient, "lastAncientBlock", lastAncient)

for i := numAncients; i <= lastBlock; i += batchSize {
numbersHash := rawdb.ReadAllHashesInRange(newDB, i, i+batchSize-1)
Expand Down Expand Up @@ -89,7 +90,7 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui
}

if numAncients > 0 {
piersy marked this conversation as resolved.
Show resolved Hide resolved
toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, numAncients)
toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, lastAncient)
log.Info("Removing frozen blocks", "process", "non-ancients", "count", len(toBeRemoved))
batch := newDB.NewBatch()
for _, numberHash := range toBeRemoved {
Expand Down
Loading