erigontech / erigontech/erigon
db/snapshotsync: caplin snapshots never call RemoveOverlaps on the node path
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 455
Description
`RemoveOverlaps` is reachable for both caplin collections, but nothing on the node path calls it. The only call sites are the CLI — `cmd/utils/app/snapshots_cmd.go:3549` for blocks and `:3556` for state — and both pass `onDelete == nil`.
EL calls it from `BlockRetire.MergeBlocks` immediately after `merger.Merge`, with `seeder.Delete` as the callback (`db/snapshotsync/freezeblocks/block_snapshots.go:333-337`). Caplin has no equivalent: `antiquate`, `antiquateBlobs` and the state antiquary's `DumpCaplinState` open and seed the new files and leave whatever they superseded on disk.
So:
- on a running node, overlapping caplin segments accumulate until someone runs `seg retire` by hand
- when that CLI run does remove them, `onDelete == nil` means the seeder is never told the files went
#23374 landed the guards that make removal safe for caplin state — equal-range version supersession, and a veto that refuses to unlink a subset whose only covering file has no index on disk. This is the wiring half of it.
Part of #23024, item 2.
Contributor guide
Research direction
Start with db/snapshotsync/freezeblocks/block_snapshots.go:333-337 and trace the caplin paths in antiquate, antiquateBlobs, and the state antiquary's DumpCaplinState. Compare them with cmd/utils/app/snapshots_cmd.go:3549 and :3556, then verify that running-node cleanup removes superseded files and reports deletions to the seeder without bypassing the guards from #23374.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100