Skip to content

pool: O(1) archive pin check, follow-ups to #380 - #381

Merged
CMGS merged 3 commits into
mainfrom
pool-pin-lookup
Oct 26, 2026
Merged

CMGS merged 3 commits into
mainfrom
pool-pin-lookup

Conversation

@CMGS

@CMGS CMGS commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Follow-ups to #380.

Changes

  • archiveCkPinned copied the whole pin set under m.mu to test one id. It now reads the claim store's reference counts and the pending set directly. Callers: DeleteCheckpoint, retryArchiveDelete (once per delete marker) and dropStaleRow.
  • deleteCkLocked had one caller left after fix(sandboxd): retain checkpoints through failed claim writes #380; it is inlined into sweepExpiredCheckpoints.
  • TestArchiveDeleteRetryRechecksWakeRollback received from an already-drained closed channel a second time; the dead receive is removed.
  • docs/cluster.md:
    • a checkpoint the claims journal may still name is not deleted; after a failed journal write the delete waits for the next write that lands, and a replica retirement keeps its tombstone until the hourly sweep after that;
    • turning archive_failover off leaves a replica claim's row and checkpoint behind when the claim ends;
    • the replica release order is tombstone, then replica;
    • the on_expire value is destroy, not release.

Prod −3 lines, test −1, 0 comments added.

Performance

5000 claims each holding a checkpoint, mac M2 Max, -cpu 1, arms interleaved main/branch/branch/main ×3:

main this PR
archiveCkPinned, one call 162 µs, 218 KB, 18 allocs 25 ns, 0 B, 0 allocs
pinnedArchiveCks (control) 164 µs 164 µs

Verification

  • golangci-lint v2.13.2: 5 modules × linux/darwin, 0 issues; fmt --diff empty.
  • asl: only the five existing forwarder advisories.
  • go test -race ./... in sandboxd: pass on macOS; pass on Linux arm64 as uid 1000, except utils/TestCloneFileRemovesFailedDestination, which fails the same way on main in that container.

CMGS added 3 commits October 26, 2026 17:17
archiveCkPinned copied the whole pin set under m.mu to test one id. The
claim store already counts references, so the check is a map lookup:
5000 checkpoint claims, mac m2 max, interleaved, 162 us / 218 KB / 18
allocs -> 25 ns / 0 allocs. DeleteCheckpoint, retryArchiveDelete (once
per marker) and dropStaleRow call it.
… failover off

Also fix the replica release order (tombstone before replica) and the
on_expire value (destroy, not release).
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.

1 participant