db: ERIGON_NO_RETIRE to disable aged files removal #22364
Merged
Merged
Conversation
…-switch Env kill-switch to disable deletion of aged frozen files, just in case. Off by default; ERIGON_NO_RETIRE=true makes both file-deletion paths no-ops: Aggregator.Retire (history/II files) and pruneBlockSnapshots (block .seg files). Does not touch file building (retireBlocks/collate) or DB prune.
bf55a46 to
e71330b
Compare
… build/delete to end "retire" collision "Retire" meant two opposite things: building block files (DB -> .seg) and deleting aged frozen files. Rename the block build path to say "build" and the block-file deletion to say "retire", matching Aggregator.Retire: RetireBlocksInBackground -> BuildFilesInBackground RetireBlocks -> BuildFiles retireBlocks -> buildFiles pruneBlockSnapshots -> retireBlockSnapshots Pure rename, no behavior change. Type BlockRetire and the bor build helpers are left as-is.
…e type to BlockFileBuilder The type builds block snapshot files (DB -> .seg); "Retire" now means deleting aged frozen files (Aggregator.Retire, retireBlockSnapshots), so the old name was actively misleading. Rename the struct, the services.BlockFileBuilder interface, NewBlockFileBuilder, and the fields and locals that held it. Pure rename, no behavior change.
ERIGON_NO_RETIRE to disable aged files removal
# Conflicts: # db/snapshotsync/freezeblocks/block_snapshots.go # execution/execmodule/execmoduletester/exec_module_tester.go
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new env-controlled kill switch to disable deletion/retirement of aged frozen files, allowing operators to retain historical state/snapshot files even when pruning is enabled.
Changes:
- Introduces
dbg.NoRetire()(ERIGON_NO_RETIRE=true) and wires it into history/II retirement and block snapshot aging deletion paths. - Renames block “retire” APIs to “build files” (
RetireBlocks*→BuildFiles*) to better reflect behavior. - Updates related comments/tests/call sites to match the new naming and behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| node/components/storage/provider.go | Updates comments to reflect “file building” terminology. |
| execution/stagedsync/stage_snapshots.go | Uses dbg.NoRetire() to skip aged block snapshot deletion; updates naming/call sites. |
| db/state/retire_history.go | Skips history/II retirement when dbg.NoRetire() is enabled. |
| db/snapshotsync/freezeblocks/block_snapshots.go | Renames core block snapshot building APIs (retireBlocks → buildFiles, etc.). |
| db/snapshotsync/freezeblocks/block_reader_test.go | Renames tests/import style to align with new terminology. |
| db/services/interfaces.go | Updates the BlockRetire interface method name to BuildFilesInBackground. |
| common/dbg/experiments.go | Adds noRetire env flag and exported accessor NoRetire(). |
| cmd/utils/app/snapshots_cmd.go | Updates the retire command to call BuildFiles. |
Comments suppressed due to low confidence (1)
db/services/interfaces.go:123
- The BlockRetire interface method uses
miBlockNumas a parameter name, which looks like a typo and makes the API harder to read (especially now that the method was renamed to BuildFilesInBackground). Consider renaming it tominBlockNumfor clarity; parameter names are not part of the interface method set in Go, so this is safe for implementers.
BuildFilesInBackground(
ctx context.Context,
miBlockNum uint64,
maxBlockNum uint64,
lvl log.Lvl,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- fix miBlockNum -> minBlockNum typo in the BlockRetire interface param - realign stray BlockFileBuilder references (comments, test names) back to BlockRetire after the type rename was reverted
awskii
approved these changes
Jul 10, 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.
ERIGON_NO_RETIRE=true(off by default) makes both file-deletion paths no-ops:Aggregator.Retire(db/state/retire_history.go).pruneBlockSnapshots(execution/stagedsync/stage_snapshots.go), which deletes aged.seg/idx files on a pruned node.It deliberately does not touch file building (
BlockRetire.retireBlocksmoves DB data into.segfiles; the aggregator's collate/build) or DB pruning — only the deletion of already-frozen files.