Skip to content

db: ERIGON_NO_RETIRE to disable aged files removal #22364

Merged
awskii merged 18 commits into
mainfrom
alex/exp_no_retire_36
Jul 10, 2026
Merged

db: ERIGON_NO_RETIRE to disable aged files removal #22364
awskii merged 18 commits into
mainfrom
alex/exp_no_retire_36

Conversation

@AskAlexSharov

@AskAlexSharov AskAlexSharov commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

ERIGON_NO_RETIRE=true (off by default) makes both file-deletion paths no-ops:

  • History/II state filesAggregator.Retire (db/state/retire_history.go).
  • Block snapshot filespruneBlockSnapshots (execution/stagedsync/stage_snapshots.go), which deletes aged .seg/idx files on a pruned node.

It deliberately does not touch file building (BlockRetire.retireBlocks moves DB data into .seg files; the aggregator's collate/build) or DB pruning — only the deletion of already-frozen files.

…-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.
@AskAlexSharov AskAlexSharov force-pushed the alex/exp_no_retire_36 branch from bf55a46 to e71330b Compare July 10, 2026 03:03
@AskAlexSharov AskAlexSharov requested a review from mh0lt as a code owner July 10, 2026 03:03
… 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.
@AskAlexSharov AskAlexSharov changed the title db/state, db/snapshotsync, common/dbg: add ERIGON_NO_RETIRE kill-switch db: ERIGON_NO_RETIRE to disable aged files removal Jul 10, 2026
# Conflicts:
#	db/snapshotsync/freezeblocks/block_snapshots.go
#	execution/execmodule/execmoduletester/exec_module_tester.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (retireBlocksbuildFiles, 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 miBlockNum as 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 to minBlockNum for 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.

Comment thread execution/stagedsync/stage_snapshots.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comment thread db/snapshotsync/freezeblocks/block_snapshots.go
Comment thread db/services/interfaces.go Outdated
Comment thread node/components/storage/provider.go Outdated
Comment thread node/components/storage/provider.go Outdated
Comment thread node/components/storage/provider.go Outdated
Comment thread execution/stagedsync/stage_snapshots.go Outdated
- 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
@AskAlexSharov AskAlexSharov requested a review from Copilot July 10, 2026 09:00
@awskii awskii enabled auto-merge July 10, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread common/dbg/experiments.go
Comment thread db/snapshotsync/freezeblocks/block_snapshots.go
@awskii awskii added this pull request to the merge queue Jul 10, 2026
Merged via the queue into main with commit 582ad6f Jul 10, 2026
99 checks passed
@awskii awskii deleted the alex/exp_no_retire_36 branch July 10, 2026 10:39
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.

3 participants