[bal-devnet-3] --exec.no-prune now disables all DB pruning#20914
Merged
mh0lt merged 1 commit intobal-devnet-3from Apr 29, 2026
Merged
[bal-devnet-3] --exec.no-prune now disables all DB pruning#20914mh0lt merged 1 commit intobal-devnet-3from
mh0lt merged 1 commit intobal-devnet-3from
Conversation
…isables all DB 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. Most relevant for bal-devnet-3 testing: BAL rows were being deleted every step once ForwardProgress > MaxReorgDepth, even with the flag set. 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.
3 tasks
yperbasis
pushed a commit
to Sahil-4555/erigon
that referenced
this pull request
Apr 30, 2026
…pruning (erigontech#20915) ## 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: - \`PruneExecutionStage\` was calling \`rawdb.PruneTable\` on \`kv.ChangeSets3\` and \`kv.BlockAccessList\`. - \`PruneTxLookup\`, \`PruneWitnessProcessingStage\` and \`SnapshotsPrune\` (\`PruneAncientBlocks\`, \`pruneCanonicalMarkers\`, \`RetireBlocksInBackground\`, \`pruneBlockSnapshots\`) had no guard. ## 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: erigontech#20914 ## Test plan - [x] \`go test ./execution/stagedsync -run TestNoPrune\` — new \`no_prune_test.go\` seeds rows in \`kv.ChangeSets3\`, \`kv.BlockAccessList\`, \`kv.TxLookup\`, \`kv.BorWitnesses\`; runs all four prune entrypoints with \`NoPrune=true\`; asserts no rows deleted and \`PruneProgress\` is recorded. - [x] \`make lint\` — clean. - [x] \`make erigon\` — builds. Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
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:
The most disruptive case for bal-devnet-3 testing: BAL rows were being deleted every step once `ForwardProgress > MaxReorgDepth`, even with the flag set.
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.
Test plan