Skip to content

Retire checkpointed relocation records safely - #3420

Draft
matrixarkai wants to merge 7 commits into
mainfrom
fix/reflected-relocation-retention
Draft

matrixarkai wants to merge 7 commits into
mainfrom
fix/reflected-relocation-retention

Conversation

@matrixarkai

@matrixarkai matrixarkai commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Change

Fold durable relocation records into the owned checkpoint image before publication. Carry a capture cutoff and sealed-piece identity evidence into post-publication cleanup, so reflected records can be retired without treating every anchor-less record as reflected.

Keep concurrent post-capture records, unrelated anchor-less content, records above the WAL anchor, and replaced sealed pieces. Do not use the capture sequence as a recovery cursor. Defer live WAL-registration retirement when folding changes only the owned image.

Complete relocation replay for feature series, control-state blocks, context nodes, context entities, and context series. Group series moves by owner so each record walks that owner's points once rather than once per moved block. Preserve newer addresses and apply chained moves in record order.

Use the fixture's actual container element names in the all-model test, since its block projection omits them. Pin the idle traversal guard to eight complete walks and compare raw entries rather than a truncated quotient; the previous hard gate observed eight but expected nine.

Retain the original active-file handle at the capture boundary and open immutable pieces one at a time. Release the append mutex while streaming and folding those fixed-length prefixes. Concurrent appends and rotations cannot replace the captured active prefix. Preserve the fixed sequence cutoff and sealed-piece identity checks, and propagate an initial queued-write failure before folding anything.

Validation

Draft: broader durability validation and performance measurements remain outstanding. The committed source tree of 798995e exactly matches the validated tree 46267aabf77727a2cd25e8b6be2041f4ff5cd687. Rust 1.89 release library/test-target typechecking and release harness compilation passed, followed by 70 passing tests, no failures, and two ignored large-scale tests. The prior head's CI all-target and direct-mode SDK checks passed; CI must finish on the new head before merge.

All eleven added tests enumerated exactly once and passed on that head. These cover captured versus late records, sealed cleanup, unknown content, newer WAL records, foreign captures, replaced pieces, checkpoint/reopen with both codecs, all 15 live model kinds, and a 10,000-point shared-block series. The append/rotation control passed all four arms while folding was paused. Queued-write failure and invalid sealed cutoff controls also passed. The all-model check is an in-memory fold check, not physical reopen coverage for all models.

The final selected run covers relocation capture and replay, sliced compaction, wire encoding, dump capture, publication ordering, WAL-registration scope, catalog retirement, and the exact raw-entry idle traversal guard. Every selector matched and passed at least one test. The harness SHA-256 is 24e1e2603b88ab2840b78afdf61167319019772cbf4afcaca595ce33e10d5f3b; source fingerprints were identical before and after validation. No resource guards were lowered.

Corrected the compaction-record guard to distinguish ordinary deltas, reject decoding failures, and require exactly the source-block set the pass moved, with no duplicate records. The restore guard measures both index loaders separately and still pins full-load work: four relocation-fold frames plus 12 catalog frames, totaling 16. This exposes the catalog's full-history scan; it does not remove that cost or claim a restore speedup. Both corrected groups passed.

An additional selection for compaction barrier/publication failures, restart after reclaim, and portable checkpoints did not execute: its resource wait expired below the shared disk minimum. Those checks remain outstanding. The separate pinned storage executable previously passed nine functional checkpoint/compaction controls; those results are not matched stage timings.

Directory enumeration and prefix opening still use the index-log mutex; streaming decode and model folding do not. Measure checkpoint latency, lock hold, retained bytes, and reopen cost before making a performance claim or enabling merge. Keep this draft out of main until applicable correctness and crash checks pass.

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.

2 participants