Live checkpoint advance: fenced redesign

This page is part of the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at LiveAdvanceDesign.md, and llms.txt lists every page.

Design for issues #5572 and #5593, epic #5605. Its production members land in the order Production members sets; the live advance itself is BPlusLeafGrain.TryAdvanceLiveCheckpointAsync. WalLiveAdvance.tla beside this note models it, with variant configurations and its mutations in mutations/. A module under spec/ must cite a production detector on every behaviour row, so this draft sits outside module discovery. It becomes the companion module spec/wal/WalLiveAdvance, with a refinement note, when the production members land.

Now promoted. The production members have landed, and the CI authority for the live advance is no longer this draft: it is the five modules promoted from it - WalAppendEpoch, WalHandOffFence, WalRoutingFloor, WalBulkSwitch and WalLiveAdvanceCore - and the composite interface check that composes them (#5774), against the contract in LiveAdvanceInterface.md. This note stays the design authority. WalLiveAdvance.tla and its configurations, several of them past the CI case budget, are kept as local evidence, and the counts this note cites for them are local measurements.

Gate. A production member starts only once the independent reviewer has accepted the part of the design it builds. The re-review of revision 3 accepted member 1 (the epoch claim, stamped appends, the gate, seam retries, the floor, and the generation and epoch rows). The re-review of revision 4 accepted member 2, except the tree range-delete fence's re-stamp path, which waits for the reviewer to confirm this revision's model change. Members 3 and 4 follow member 2.

Revision. This is the eighth revision. It answers the re-review of revision 7: the epoch row's conditional write is load-bearing again, since AlreadyDurable relies on it, so ClaimAdoptsNoCas is a mutation (16 states) and step 2 says so (S1); the purge straddle text covers a duplicate's bump landing before the clear's conditional row delete (N1); and TreeWalk cites 22,966,529. Two clarifications follow production members 2 and 3: section 2 states that a leaf initiator's close bumps its epoch, that its own rejected appends are a self-fence, and that whoever appends a record stamps it with its own epoch (the census rows for receiver-appended hand-offs are corrected); and section 3 corrects change 4's reading of 10.2.0. Bulk entries carry real HLC versions, so a contested key resolves last-writer-wins by stamp, the later-stamped write winning, not "the point write wins". The behaviour is unchanged (still last-writer-wins, still a compatible bug fix); ContestedKeyAgrees now versions the bulk entry in time, and its mutation is StrandedValueKept.

Revision 7 superseded revision 6 on one point, #5641, which the independent review of member 1 found: production admits a claim equal to the durable entry (AlreadyDurable), and a clear deletes the epoch row, so a floor built from entries alone let a pre-purge duplicate and the re-created incarnation hold the same epoch. Retirement now raises the floor to the higher of the entry and the epoch row (section 1, "Retiring entries"), the model admits AlreadyDurable as production does, and the entry-only floor is mutation FloorFromEntryOnly. It also folds in the reviewer's partial findings on revision 6: OtherIntentClose makes rule 3's own case reachable, OnlySupersededRefused also flags a conflict-free ClaimConflict, the Recreate configuration runs with Ghosts on, and a cold leaf's first-write latency is behaviour change 11.

Revision 6 answered the re-review of revision 5 (1 blocking, 2 should-fix, 2 nits), which confirmed #5635 sound and let member 1 proceed:

  • A rejected range-delete walk re-stamps only under its own intent (B1, rule 3 in section 2), with mutation RestampUnderAnyIntent.
  • Any refusal bumps while the activation's ETag holds (S1), as production does: an entry refusal with the row unmoved is the purge straddle, now named in section 1. The model gains an ETag stand-in (rowInc) and the widened ClaimBump.
  • OnlySupersededRefused replaces CurrentNeverFenced (S2): it is behavioural, where CurrentNeverFenced was definitional.
  • Step 1 describes production's ClaimRowAsync, and production's re-claim after a bump and its cost are stated (N1, N2).

Revision 5 answered there-review of revision 4 (1 blocking, 3 should-fix, 2 nits):

  • The re-stamp is atomic with the close (B1). The fence grain marks an intent closed before the close's first re-claim, and answers the open check and the generation from that one state, in turns that do not interleave with a close. The model gains GRestamp and GUnstamped and a two-window configuration, and the split close is a mutation. Section 2, "A walk outliving its intent".
  • The intent's deadline takes the SagaDecisionDeadline form and affects liveness only (S1). The shard root asks the fence grain only after a rejection, never per page (S2). The cost of unstamped walks is stated, with a counter by source (S3).
  • The retired floor is checked at the claim only, never on an append (#5635). The floor is one value per partition while epochs are per leaf, so an append check would supersede live leaves after another leaf's retirement. Member 1 found it. The model gains RetireOther and CurrentNeverFenced, with a mutation. Section 1.
  • Member plan: #5634's epoch-row sweep is member 5; the terminal class (member 2) lands before member 4 arms any leaf.

Revision 4 answered there-review of revision 3 (2 blocking, 4 should-fix, 3 nits), which accepted revision 3 for production member 1 and held member 2 for this revision:

  • The range-delete fence stamps every shard's walk with one per-tree range-delete generation, owned by a new TreeRangeDeleteFenceGrain, so one re-claim per partition fences every walk (B1). A walk with no open intent is appended unstamped (B2). The intent records a deadline, and its reminder has a named owner (S3); the per-step cost of stepped range deletes is stated (S4). Section 2.
  • Generation rejections are retried from the shard root through its routing check (S1, section 5). The terminal stamp class is accepted only for TxCommit and TxAbort (S2).
  • Change 4 (a bulk append over a key the range already holds) is now last-writer-wins, last-writer-wins by HLC stamp, which is what 10.2.0 converges to on every reader: a compatible bug fix needing no authorisation (section 3, "Which value wins").
  • The model gains WithTreeWalk (another shard's walk) and ContestedKeyAgrees (origin and replica agree on a contested key), with their mutations and witnesses; the redundancy checks are committed in redundancy/.

Revision 3 answered the re-review of revision 2 (4 blocking, 8 should-fix, 3 nits), and keeps the answers to the first review. The hard requirement still applies: no unauthorised breaking change against the shipped lattice 10.2.0 (tag lattice-v10.2.0). Backward compatibility lists every observable behaviour change.

  • Revision 2's behaviour change 3 is withdrawn. Fence rejections are now retried where they are raised, until the operation's existing deadline (section 5). No caller sees a new exception cause.
  • No change needs the user's authorisation. Change 4 (bulk append over a key the range already holds) is last-writer-wins, which is what 10.2.0 converges to on every reader.

The last sections map every finding of both reviews to its resolution.

Contents

Why the first attempt was withdrawn

The first attempt (#5578, withdrawn from the bucket at 9a6c10813) let a leaf advance its projection checkpoint over the appends it had issued and applied itself, without reading the records in between. Replay ownership is by key range and shard map, not by author, so other writers append records a leaf owns. The advance passed such records unread:

  • A duplicate activation. A leaf's writes go to the WAL and never persist its row, so a stale duplicate keeps appending acknowledged writes without moving the row's ETag. The other activation passed them, persisted its checkpoint, captured into the shared per-leaf snapshot store and published a pin. The GC trimmed them. The born-at-admission rule (#5593) did not close this.
  • Foreign authors. A split donor, a reclaim neighbour, an adaptive split's or a shard fold's donor shard, a range delete, and the leaf a write reached before a bulk switch. A range delete's record is not key-scoped: it carries the whole requested range, and every leaf of every shard whose range overlaps it replays it (WalKeyFilter.IsKeyScoped filters only Set, Delete and Tombstone, and the replay judge tests key overlap only). An unacknowledged record from one of these authors was skipped by its owner but still applied by a WAL reader such as the replication shipper or a view.
  • The bulk interleave. A batch write that landed on the old leaf during a bulk load or append became invisible on the bulk leaf that took over its range.

mutations/NoTrimPastAckedLiveAdvance5578.mutation reproduces that design in the model and fails "no trim past an acknowledged append" (trace below).

Production members

Each production member carries detectors proven red. They land in this order:

  1. Epoch claim, stamped appends and the gate.
    • The epoch, entry, floor and generation rows; the three-step claim with its conditional max-merge; ClaimAppendEpochAsync, AppendStampedAsync and AppendBatchStampedAsync; the unloaded-entry reload; the unstamped watermark and the own-append self-report; the floor checks at the claim's write and raise, and none on the append path (#5635).
    • WalAppendFenceOutcome, the supersession as LeafRetiredException with its two trailing members, and the seam retry of section 5 for every caller in its table, each with a detector that the caller's 10.2.0 outcome is unchanged: an atomic write commits, DeleteAsync and a CRDT delta succeed, and replication apply counts no failure.
    • Entry retirement in pin retirement and the purge tail, run regardless of the gate, and the orphaned-row sweep.
    • IWalAppendFenceCapable and its manifest gate; the mixed-version test pinning a 10.2.0 silo's "method unknown" failure.
    • JSON and binary round-trip tests for every new state type. A test that every 10.2.0 grain interface method still exists with its signature.
  2. Hand-off markers and fences.
    • Split, leaf reclaim, adaptive split, shard fold, and the tree-level range-delete fence: TreeRangeDeleteFenceGrain with its intents, deadlines, reminder and per-tree range-delete generation, and the stamped shard-root range-delete method (the existing method appends unstamped).
    • Generation rejections retried from the shard root through ThrowIfRejectedForKey.
    • The terminal class accepted only for TxCommit and TxAbort.
    • Resume opens the marker, and the marker-initialised state.
    • The shard routing generation, stamped at admission; the unstamped leaf methods appending unstamped.
    • The stamp census, including the terminal stamp class.
    • Ordering dependency (found by member 1): the coordinator-terminal stamp class must land before member 4 arms any leaf. Saga terminals from ShardRootGrain.TxTerminal and AtomicWriteGrain otherwise append unstamped and raise every partition's unstamped watermark, holding every leaf writing those partitions on the replay-based advance.
  3. Bulk. #5610's relocating graft, fixed with #5614; the birth hint captured with it and persisted in _lattice_shard-handoff; bulk-leaf ranges; and the switch's marker and fence.
  4. The live advance itself.
    • Armed only by the rules above.
    • Arms nothing before #5664 lands: the close heads must bound every record the initiator appends (section 2, "What the close heads must bound").
    • It reuses #5578's applied-prefix tracker and the core extraction from the abandoned #5596.
    • Formal work: production only. WalDurability stays unchanged (Formal impact) and gains a gap entry naming WalLiveAdvance as the live advance's safety argument and citing member 4's detectors; PinRetirementRefinement.md gains the entry-retirement rows. #5578's LiveAdvance and NewbornPinEventuallyUsable are not re-landed in WalDurability. The PR maps each production arming guard to a conjunct of Armed(a), so the promoted module's refinement note can cite the detectors.
  5. Epoch-row sweep (#5634). The per-partition epoch directory row, bucketed or paged within the provider's row limits, and the sweep that retires the entries of leaves that no longer exist, which a 10.2.0 silo's retirement leaves behind. It lands before #5605's bucket reaches main, independently of members 2 to 4. With it, #5668: the purge's retirement of the per-tree fence rows behind the routing floor, and the floor-seeded, fencing first initialisation (section 2, "Purging a tree's fence rows").
  6. Promotion. WalLiveAdvance becomes a module with its refinement note, its manifest, its redundancy rows (with a redundancy class in the mutation catalogue, or kept out of the catalogue gate's glob, so a clean run is not reported as a missing violation), and every combined configuration the reviewer named (Mixed+Restart+duplicate on the full instance, own unstamped appends with the self-report, repeated unstamped appends, the split claim under Restart, and the fifteen configurations above) in CI, on a dedicated or measured TLC shard. It also adds the liveness property #5572 asked for and the draft model lacks: under weak fairness of the claim, replay, apply and LiveAdvance steps, an armed activation's newborn pin eventually becomes usable without a replay from -1 (the successor of #5578's NewbornPinEventuallyUsable), checked on a small configuration. Nothing from phase 2 reaches main before this member lands.

Open questions for re-review

None. Per the re-review of revision 4, the reviewer can confirm B1 from the model diff: GRestamp, GUnstamped, closing, the two TreeWalk configurations and ReadPositionHonestRestampDuringClose.