Table of Contents

Live checkpoint advance

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 live-checkpoint-advance.md, and llms.txt lists every page.

Part of Write-Ahead Log.

A leaf whose WAL partition holds no record it has not read, other than its own writes, may advance its projection checkpoint over those writes without replaying them (#5570, #5572, #5593; design note section 1). Before it, a leaf written only through the live path banked no usable durable pin until its coverage-lag timer had spent a replay permit reading its own writes back, so a fresh tree held its WAL floor for up to LeafSnapshotMaxCoverageLagSeconds.

When a leaf may advance. Per partition, the activation advances its checkpoint to the highest offset its own applied appends returned, and only when every one of these holds; otherwise the checkpoint advances by replay, as before. These are the rules for a partition the activation has claimed. Under the pre-arm class a partition it has not claimed can also advance, by the rules in The claimless advance:

  1. Claimed. The activation holds a claim at the partition under its current epoch, and its view of the append-fence gate is open.
  2. Read to the claim head. Its checkpoint has reached the claim head minus one: it has read everything allocated before it claimed, including an acknowledged write of a stale duplicate activation (#5593). A new tree's first leaf claims at head 0 and needs no replay; an existing leaf replays to its claim head once.
  3. No hand-off open. Its marker is initialised, no token is open on it, and no token on its shard root's marker overlaps its key range. An existing leaf adopts its shard root's initialised flag once it has no split in flight.
  4. Read to every close. Its checkpoint has reached the heads every closed hand-off overlapping it recorded.
  5. Read past every reported unstamped append. Its checkpoint is at or past the highest unstamped offset the partition reported to it. A write through an unstamped leaf method reports itself, so it too falls back to replay.
  6. Quiescent. Every own append the activation issued has been applied, none failed, no saga prepare is pending, and no replay is running. An append refused before anything was allocated - the self-fence of a write admitted before a hand-off close, a stale routing generation, or a single-record clock-floor refusal - is released, since it left nothing to apply and its write is retried (#5708). Any other failure, such as a timeout, may have landed a record, so it holds the advance for the activation.

The advance also holds for the whole leaf when the leaf has no shard slot, when it covers no key range but has siblings, when the grain storage provider's ETag check did not report the provider fenced at silo start (The grain storage provider must enforce ETags), or when it is suspected to be an orphan: the shard root's descent for its low key does not reach it, or orphan repair is running. The markers and the shard root's view are read fresh on every attempt; the shard root answers on an interleaving, read-only call, so a serial shard-root turn that calls the leaf cannot deadlock against it.

An unreachable leaf never appends stamped (#5709). An orphan - a leaf in the sibling chain that descent no longer reaches, often sharing a live leaf's bounds - can still be handed a write by a span forward from its neighbour. If it stamped that write, the live leaf owning the same keys could advance past it unread. So before an activation's first epoch claim, the leaf asks its shard root, once, whether descent for its low key reaches it. If it does not, and no hand-off marker is open on it, the activation claims nothing and appends unstamped: every append is reported to the leaves sharing the partition, whose replay applies it by key range before they can arm. One such answer leaves the leaf undecided rather than latched (#5872), because descent can transiently miss a leaf it reaches: for a backoff the leaf appends unstamped, never pre-arm and never claiming, then asks again. A reachable answer proves it; a second unreachable answer after the backoff latches it unstamped for the rest of its life. It latches on the first answer when its orphan status is structural: orphan repair is running on its range, a reclaim has absorbed it, or a newer activation has superseded this one. A split sibling the parent has not yet learned of is exempt: it is born under its donor's open marker and admits only keys the donor has narrowed away. The advance tick and a split's cut repeat the check under the same rule; an unconfirmed answer at the cut means the split takes no birth hint from it. If the shard root cannot be asked, or its descent could have taken a stale route (#5876) - through an internal node that has divided while its parent does not yet route to the new half (every internal node reports the key it divided at, and the descent checks it), or across a change to the shard's root, a bulk graft or a shard split - the answer is no verdict: the leaf appends unstamped and asks again after a backoff, a split transfer's routing is not refreshed on it, and the orphaned-leaf audit reports the leaf as RoutingInMotion rather than judging it.

Rolling upgrade. A shard root on a build without the three-valued descent - 10.2.0, or any earlier build of this branch - cannot answer a leaf's reachability question: the call fails, and the leaf treats the failure as no verdict, appending unstamped and asking again after a backoff. It never proves, latches or claims on such a root, so the only cost of a mixed cluster is the unstamped appends until the shard root is upgraded. Orphaned-leaf repair never folds an orphan's rows; it clears an orphan only after proving every row it holds is readable from the reachable owner.

Where it runs. On the coverage-lag tick and at the start of a starvation drive, so the tick banks a snapshot and a usable pin for a live-written leaf without taking a replay permit.

Bulk-loaded leaves are held while their shard's bulk: switch is open over their range, and arm once it has closed and they have read to its heads and their claim head. Their checkpoint starts at the bulk birth hint where one was applied, which shortens their activation replay; where none was, they replay from the log's start, as before. Arming needs no bulk-specific rule.

A bulk operation seeds its leaves before it publishes them, and the seed claims no append epoch (#5812). Under the open switch the seed carries the shard root's routing generation, read after the switch's marker opened. The WAL partition admits it only when that generation matches the one it has loaded, never on an absent entry, and does not report it as unstamped: every leaf that can own a seeded row is held on the switch until it reads to the close heads, and every close re-claims the generation, which refuses a seed still in flight from an abandoned attempt. A bulk-born leaf's first claim at a partition is made by its first live write, once it is reachable, exactly as a normally born leaf's is. A shard with no root when a bulk load begins, such as a restore shadow or a snapshot destination, has no leaf for a switch to protect: the load opens no marker, stores no hint and runs no fence, and seeds unstamped, which every partition admits and reports. The load checks, in the same step that publishes its root, that no batch write seeded a root meanwhile; if one did, it opens its switch then, relocates that root's rows and closes by fence, as on any other shard.

Rolling upgrades. Nothing arms while the gate is closed, and the leaf issues no marker read and no shard-root call while no partition is claimed and the pre-arm gate is closed, so a shard root on an older build is never asked for its view.

Cost. Nothing is added to a write: the tracker is a counter and one offset per partition, updated as an append completes, and a refused append adds one interlocked increment. Only a leaf with own writes above its checkpoint does anything on a coverage-lag tick, and then:

  • the leaf reads its own marker row and makes one shard-root call;
  • the shard root reads its marker row and descends for the leaf's low key, the same traversal it routes a write by, and returns only the marker's projection onto the leaf's range (an immutable value, so a same-silo call copies nothing);
  • the leaf decides on a per-activation copy of its offsets and computes close heads per partition, allocating no array.

A leaf with nothing to advance, or with no partition claimed while the pre-arm gate is closed, reads nothing and makes no call. Once per leaf, a marker write adopts its shard root's flag. Once per activation, before its first claim, one shard-root call proves the leaf is reachable; a leaf that is not also reads its own marker row.