execution/stagedsync, cmd/utils: --exec.no-prune now disables all DB pruning#20915
Merged
AskAlexSharov merged 2 commits intomainfrom Apr 30, 2026
Merged
execution/stagedsync, cmd/utils: --exec.no-prune now disables all DB pruning#20915AskAlexSharov merged 2 commits intomainfrom
AskAlexSharov merged 2 commits intomainfrom
Conversation
…pruning The --exec.no-prune flag previously only gated the state-aggregator's Domain/InvertedIndex/forkable pruning via dbg.NoPrune(). Stage-level pruning ran regardless: PruneExecutionStage was still calling rawdb.PruneTable on kv.ChangeSets3 and kv.BlockAccessList, and PruneTxLookup, PruneWitnessProcessingStage and SnapshotsPrune were fully active. Add early-return guards on dbg.NoPrune() at the top of each prune entrypoint so the flag genuinely blocks every path that removes rows from MDBX. Bookkeeping (s.Done) still fires so the staged-sync state machine doesn't re-enter the prune step on every cycle. New test no_prune_test.go seeds rows in the affected tables, runs all four prune entrypoints with NoPrune=true, and asserts no rows were deleted plus PruneProgress is recorded.
AskAlexSharov
approved these changes
Apr 30, 2026
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
`--exec.no-prune` previously only gated the state-aggregator's pruning paths via `dbg.NoPrune()` (Domain/InvertedIndex in `db/state/aggregator.go`, forkable in `db/state/forkable_agg.go`). Stage-level pruning ran regardless:
Fix
Add early-return guards on `dbg.NoPrune()` at the top of each stage prune entrypoint so the flag genuinely blocks every path that removes rows from MDBX. Each function still calls `s.Done(tx)` so the staged-sync state machine doesn't re-enter the prune step on every cycle.
Updated flag usage text to describe the wider semantic.
Companion bal-devnet-3 PR: #20914
Test plan