feat(db): add --resume flag to migrate-v2#203
Draft
chee-chyuan wants to merge 1 commit into
Draft
Conversation
Allows resuming a v1 → v2 migration that was interrupted after the StorageSettings flip but before MDBX cleanup finished. Without this, re-running migrate-v2 hits the "already v2" early-exit and leaves the DB stuck mid-migration (changesets in static files, MDBX still full of v1 tables). --resume skips phases 1–3 and runs only clear_recomputable_tables, compact_mdbx, and the swap. Bails if StorageSettings is not already v2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request ReviewThis PR adds a new Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--resumetoreth db migrate-v2so a migration interrupted after theStorageSettingsflip can finish without restarting from scratch.Why
The current migration writes
StorageSettings = v2in phase 3, then clears recomputable MDBX tables in phase 4 and compacts in phase 5. If the process dies between 3 and 5 (e.g. OOM-kill on a large archive node — we hit this on a 9.3 TB BSC archive after the changeset/receipt migration already took ~9 days), re-running falls into theis_v2() → return Ok(())early-exit and leaves the DB stuck: changesets/receipts are in static files, settings say v2, but MDBX still has the full v1 layout and stage checkpoints are not reset.--resumejumps straight to phase 4. It verifiesStorageSettingsis already v2 first, so it can't be used on a fresh DB to skip work that hasn't been done.Test plan
cargo +nightly fmt --all --checkcargo check -p reth-cli-commands(verified locally)🤖 Generated with Claude Code