Skip to content

The watch cursor

The watch cursor is the file on the node's volume that holds its position in the control plane's assignment stream, and the one live object in the process that owns that position. This page covers where the file sits, what the process keeps in memory beside it, the identity it is bound to, and the two conditions that make a node's position suspect.

The four revisions the file holds are covered by The assignment cursor. How a reconcile cycle reads and advances the position is covered by Watch cursor and pull ingest.

Where the file sits

/var/lib/xratu/cursor/xratud_watch_cursor_<dataplane_uuid>_<dataplane_instance_uuid>.json

Both identity tokens are sanitised into the file name, so one directory holds one file per node identity and process instance. The directory is part of the node's retained volume, so the position carries across a restart. See Durable node state layout.

The path is resolved at startup by trying the cursor directory first and the process temporary directory second. A node whose volume is absent therefore starts, runs and records its position, and loses that position on the next restart. Confirming that the resolved path sits under /var/lib/xratu is part of verifying a node, because the symptom of a missing volume is a node that looks healthy and repeats work after every restart.

One owner in the process

flowchart TB
  subgraph PROC["XRATUD PROCESS"]
    direction TB
    OWNER["Watch cursor state<br/>single live owner"]
    REG[("Runtime state registry<br/>watch_revision<br/>watch_cursor_path")]
    FLAG{{"Corruption held<br/>as state"}}
  end
  FILE[("Cursor file on the volume")]
  CP["Control plane watch"]
  FILE -->|"loaded at startup"| OWNER
  OWNER -->|"persisted on advance"| FILE
  OWNER -->|"mirrors position"| REG
  OWNER --> FLAG
  CP -->|"next revision"| OWNER

Watch cursor state is the only object that reads or writes the file. It mirrors the live position into the Runtime state registry so the rest of the cycle reads one value, and it carries Corruption held as state so a damaged file produces a reported condition and a running node.

Bound to two identities

The record names the node identity and the control-plane identity revision it was written under:

{
  "stream_key": "dataplane_uuid=dp-9c2a...;dataplane_instance_uuid=ri-41f0...;dispatch_partition=default;channel_kind=assignment_watch",
  "bound_dataplane_uuid": "dp-9c2a...",
  "bound_cp_identity_revision": "3",
  "last_seen_revision": 812,
  "last_persisted_revision": 812,
  "last_applied_revision": 806,
  "last_acked_revision": 806,
  "cursor_digest": "7d41...",
  "updated_at": 1771459200.0
}

Those two values come from the enrollment identity state the node loads before the cursor, falling back to its configured dataplane_uuid and to the literal cp_identity_revision_unavailable when the identity state carries neither. A node that records a position under the fallback token and later learns its real control-plane identity revision loads that file as a binding mismatch, which resolves itself through a resync. See Rebuilding node state after restart.

The binding is checked on every load and every write, and a position written under a different node identity or control-plane identity is a binding mismatch. The control plane applies the same rule to itself with its identity latch. See Control-plane identity latch.

Two conditions make a position suspect

The file fails its checks. An unreadable file, a missing field, a failed ordering invariant, a digest that does not match the stored fields, a stream key for another stream, or a binding for another identity. The owner holds the corruption flag, keeps running at the configured initial revision, and the next watch carries a resync. The full set of reasons is on Assignment cursor runtime.

The control plane reports a gap. The node's position is past what the stream holds, so the control plane answers with a snapshot and a resume point. See Gap handling.

In both cases the position moves to what the control plane says, and the corruption flag clears once that resync has been taken.

The node's own file is kept for its whole life

The node loads exactly one cursor file: the one named by its dataplane_uuid and dataplane_instance_uuid. Both come from the enrollment identity state on the same volume, and re-enrollment for the same installation reuses them, so the file name is the same on every restart and that file is the one the node continues from.

At startup the node also sweeps the cursor directory. It removes a file only when all three hold: the file carries the cursor prefix, it is a different file from the node's own, and it was last modified more than 30 days ago. A file that passes all three was written under an identity the node no longer holds, for example one left from before the node's identity state was replaced. Such a file fails the binding check on load, so the node cannot continue from it.