Skip to content

execution/stagedsync, cmd/utils: --exec.no-prune now disables all DB pruning#20915

Merged
AskAlexSharov merged 2 commits intomainfrom
cp/exec-no-prune-cover-all-main
Apr 30, 2026
Merged

execution/stagedsync, cmd/utils: --exec.no-prune now disables all DB pruning#20915
AskAlexSharov merged 2 commits intomainfrom
cp/exec-no-prune-cover-all-main

Conversation

@mh0lt
Copy link
Copy Markdown
Contributor

@mh0lt mh0lt commented Apr 29, 2026

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: #20914

Test plan

  • `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.
  • `make lint` — clean.
  • `make erigon` — builds.

…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 AskAlexSharov added this pull request to the merge queue Apr 30, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Apr 30, 2026
@AskAlexSharov AskAlexSharov removed this pull request from the merge queue due to a manual request Apr 30, 2026
@AskAlexSharov AskAlexSharov enabled auto-merge April 30, 2026 03:54
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit fda665c Apr 30, 2026
37 checks passed
@AskAlexSharov AskAlexSharov deleted the cp/exec-no-prune-cover-all-main branch April 30, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants