Recovery contracts¶
Recovery is a contract rather than a procedure: a node that has lost its place asks for one, and what comes back is a complete statement of what it currently owns plus where to resume. This page is that contract and the conditions that call for it.
The contract¶
contract_version dispatch.recovery_contract.v1
snapshot_revision the stream position the snapshot represents
delta_start_revision snapshot_revision + 1
items the assignments active for this registration
The snapshot and the resume point are issued together. A node that applied the snapshot and then resumed at the delta start has neither skipped an assignment nor reprocessed one, because the two values describe one consistent position.
Why a snapshot rather than a rewind¶
flowchart LR
subgraph STREAM["THE WORKSPACE ASSIGNMENT STREAM"]
direction LR
H["Revisions up to snapshot_revision<br/>not replayed"]
S[("Snapshot<br/>active assignments at snapshot_revision")]
D["From delta_start_revision<br/>the live stream"]
H ~~~ S ~~~ D
end
N["xratud<br/>position unusable"]
S -->|"1 taken as current truth"| N
D -->|"2 resumed"| N
The stream reads left to right. The node receives the middle box whole and the right-hand box from its first revision, and the left-hand box never reaches it, so it neither reprocesses handled work nor skips live work.
Replaying from the beginning would redeliver everything the node already handled, and resuming further ahead would skip envelopes with no trace. A snapshot of what is active now avoids both: history is not replayed, and nothing live is missed.
Active means assigned, acked or running. Terminal assignments are absent
because a node has nothing left to do with them.
The two reasons¶
A node's position that skips a revision is CURSOR_GAP_DETECTED, and one that
cannot be interpreted is CURSOR_CORRUPTED. Both are stated rather than
inferred, and both resolve to the same remedy. Detecting a gap is the point: a node that silently continued past one would
lose assignments without any record that it had.
Recovery is scoped to a registration¶
The snapshot is built for one data plane registration, so a node recovers its own work and sees nothing belonging to another. A node that re-enrolled with a new registration recovers nothing, because the assignments it held belong to the registration that claimed them.
What recovery does not change¶
Recovery restores a node's view of what it owns. It does not extend a lease, re-mint a fence, or reopen a terminal assignment. A recovered assignment whose lease lapsed while the node was out of contact is reclaimed through the normal path, and the node's stale fence is refused on its next write.
See The assignment ledger for those refusals, and Assignment delivery and replay for how the snapshot is served.