cl/antiquary: remove overlapping caplin state segments after each dump - #23471
cl/antiquary: remove overlapping caplin state segments after each dump#23471awskii wants to merge 8 commits into
Conversation
…/blobs/state dumps
…p, re-rooting the seeder paths
|
Review of the current head. The wiring is in the wrong place: on a default node the new Bugs1. The call sits inside
2.
3. With no downloader, segments are unlinked but their
4. The key form disagrees with the downloader on Windows —
The new test hides this: 5. One failed
6.
PlacementThe shim belongs in Smaller
Test
Also, |
…de snapgen and re-key it in the collection
|
Reworked in 4b6de38. All six confirmed. 1 — and it made the PR inert, since 2 — reordered: removal first, then 3, 6 — the closure is always passed and captures the threaded 4 — right, and my test couldn't see it: it compared two 5 — mitigated, not fixed. With removal off the dump cadence a transient error costs one cycle instead of ~7 days. I left the onDelete-before-removal ordering in Empty-list guard added. The Tests in |
Caplin snapshot collections never removed overlapping segments on a running node.
RemoveOverlapswas reachable only fromcmd/utils/app/snapshots_cmd.go:3549,3556, both withonDelete == nil, so overlaps accumulated until someone ranseg retireby hand and the seeder was never told when that run removed them. EL has done this sinceBlockRetire.MergeBlocks(db/snapshotsync/freezeblocks/block_snapshots.go:333).This wires it for caplin state, where overlaps genuinely accumulate: the node dumps at
CaplinMergeLimit * 5= 50,000 slots (cl/antiquary/state_antiquary.go:625), capcli at 10,000, and mainnet ships one ~10.5M-slot merged file per state table.Changes
stateSn.RemoveOverlapson everyIncrementBeaconState, not only after a dump.--caplin.snapgendefaults false, so gating removal on a fresh dump left it unreachable on a normal node, which is where downloaded overlaps land. The dump moved intodumpCaplinStateIfDueso its early returns no longer skip the removalSeed, so a subset the dump supersedes is not hashed and announced microseconds before it is unlinkedCaplinStateSnapshots.RemoveOverlapsre-keys the reported names before passing them on. The base reports paths relative to the collection's dir, but the downloader is rooted atdirs.Snapand registers these ascaplin/<name>, slash-separated (db/downloader/util.go:87) — a bare name matches nothing andDeletereturns nil having done nothing. Putting the shim in the collection coverscmd/utils/app/snapshots_cmd.go:3556too, and usespath.Joinso the key does not becomecaplin\...on WindowsRemoveOverlapsskips the callback when nothing is being removed, which is the steady stateWhat is left out, and why
Beacon blocks and blob sidecars stay unwired. Both collections live in
dirs.Snap, shared with EL, and run into two defects in shared code that need their own fixes:OpenFolder'sNoGapsfilter drops a covered beaconblocks segment from the dirty set, andRemoveOverlapscan only unlink what is in that set. It would notify the seeder, dropping the.torrent, for a.segthat then stays on diskRemoveOverlapsunconditionally deletes every.tmpin its directory. A second collection ondirs.Snapcalling it from an independent ticker can unlink an EL merge's in-flight compressor outputCaplin state avoids the first outright: its
OpenFolderuses the unfilteredAllTypedSegmentsscan, so covered subsets reach the dirty set and are genuinely unlinked. It is not immune to the second —dir.CreateTempwrites into the output directory, sodirs.SnapCaplinholds in-flight.tmpfiles too. It is safe only becauseDumpCaplinStateandRemoveOverlapsrun sequentially on the singleloopStatesgoroutine, which parallelising the per-table dump would break.Part of #23412 and #23024, item 2.