Watch cursor and pull ingest¶
The watch cursor is the node's position in the control plane's assignment stream. It is durable, bound to an identity, and it tracks four revisions rather than one, because seen, persisted, applied and acknowledged are different facts.
The cursor¶
flowchart LR
subgraph CUR["WATCH CURSOR RECORD, on the node's disk"]
direction TB
subgraph BIND["BOUND TO"]
direction TB
B1["dataplane_uuid"]
B2["cp_identity_revision"]
end
subgraph REV["FOUR REVISIONS"]
direction TB
R1["last_seen_revision"]
R2["last_persisted_revision"]
R3["last_applied_revision"]
R4["last_acked_revision"]
end
DG["digest"]
end
CP["Control plane<br/>assignment stream"]
CP -->|"advances seen"| R1
R4 -->|"confirms"| CP
The record carries its own identity binding and digest, so a load checks both before any revision is trusted. The stream moves the first revision and the node reports the last, and the two between are the node's own progress.
Four revisions, not one¶
last_seen_revision the furthest the node has been told about
last_persisted_revision the furthest written durably
last_applied_revision the furthest actually acted on
last_acked_revision the furthest confirmed
Collapsing them would lose the distinction that matters after a restart: a node that saw a revision and did not apply it is in a different state from one that applied it and did not confirm it.
Applied and acknowledged are both clamped to what has been seen, so neither can claim to be ahead of what arrived.
The cursor is bound to two identities¶
dataplane_uuid which node this cursor belongs to
cp_identity_revision which control-plane identity it was written under
A cursor is loaded only under the identities it was written for. A binding mismatch means the cursor belongs to a different node or a different control plane, and it is not silently continued from.
That is the node-side half of the same rule the control plane enforces with its identity latch. See Control-plane identity latch.
Corruption is detected, not guessed¶
Loading a cursor either succeeds or marks corruption and falls back to the configured initial revision. Three named conditions count as corruption:
| Reason | Means |
|---|---|
| Corruption detected | The record cannot be read as a cursor |
| Digest mismatch | The record's content does not match its digest |
| Binding mismatch | The record was written under a different node or control-plane identity |
A corrupted cursor is a state the node holds and reports rather than an exception that stops it, which is what allows the control plane to issue a resync. See Recovery contracts.
Persistence never moves backwards¶
On persist, the node takes the greater of what it wants to record and what was already persisted. A request to persist a lower revision than the stored one is treated as a reset: the cursor file is removed and persistence starts from zero rather than writing a position that would look like progress backwards.
flowchart TB
A["Persist requested"]
B["Lower than what is stored?"]
C["Remove the file, restart from zero"]
D["Record the greater of the two"]
A --> B
B -->|yes| C
B -->|no| D
Behind is recoverable and ahead is loss, which is the same rule the kernel return lane follows. See Recovering the kernel link.
Stale cursor files are cleaned up¶
Cursor files older than a maximum age are removed at startup, so a node that has been reinstalled or re-identified does not accumulate positions it will never use again.
Intake has two shapes¶
A pull returns what is ready. A watch waits for the stream to pass the revision the node holds and returns empty when it does not move, which is the ordinary quiet case.
A failed watch returns the current revision unchanged. The node never advances its position on an error, so nothing is skipped because nothing was marked seen. See Liveness on the control plane link.
Related¶
- The watch cursor for the file, its single owner and the identity it is bound to.
- Persisting cursors across restart for the write path and the reset rule.
- Gap handling for a position the stream cannot honour.