TECHNOLOGY

Bind a job transition to ownership and input revisions in one etcd transaction

In this article
THE QUICK TAKE

A transaction can atomically guard several etcd keys, but its success flag, comparison targets and result revision must be interpreted under the actual branch contract.

A valid result can belong to obsolete inputs

A worker finishes a partition while another coordinator changes the input manifest. Publishing the worker’s output pointer and marking the partition complete in separate operations can accept a result for the old manifest or leave a completed marker without the intended pointer. The required decision spans several control records: current ownership, the input identity and the state transition being accepted. Treating each record as individually valid misses the relationship that makes their combined state meaningful to downstream workers and the final job aggregator.

Compare the complete admission condition

The etcd transaction API evaluates a conjunction of comparisons atomically and executes its success or failure branch accordingly. A proposed job protocol can require the expected input revision, the still-valid ownership key and the expected job state before updating the result pointer and completion record together. The concurrency reference documents ownership keys usable for guarded etcd updates. Define the condition before execution. Checking ownership in a preceding request and comparing the manifest later leaves an interval in which either premise can change.

Choose comparison targets deliberately

A value comparison asks whether bytes match; a modification-revision comparison identifies an observed mutation state. A key’s version changes with modification and resets after deletion, so it should not be treated as a globally unique lifetime identity. The creation revision identifies a different property again. Choose the target according to the application’s conflict rule, including deletion and recreation. For a job reused under a new manifest, preserving a familiar value such as ready is insufficient evidence that the original assignment is still the current assignment for that logical name.

Interpret the selected branch and response

A successful RPC is not synonymous with a true comparison. Inspect succeeded and interpret the corresponding response list. The failure branch is itself a list of operations; it is not inherently read-only or harmless. Keep it explicit so a rejected admission cannot accidentally mutate unrelated job state. The API documentation also directs clients needing the transaction revision to its top-level response header rather than interpreting inner response headers. Preserve that revision with the accepted result identity, while recognizing that response loss can still leave the client uncertain about whether the transaction completed.

Exercise competing and stale transitions

In an isolated fixture, let competing coordinators read the same job state, then attempt acceptance using their retained expectations. Change the manifest between observation and acceptance in another case, and include deletion followed by recreation. Verify that only the transition matching the declared ownership and input conditions is admitted and that related control records agree afterward. The API guarantees give one revision to the transaction’s keyspace changes. Retain actual record values and branch outcomes; a count of successful network responses cannot establish the intended atomic relationship.

Do not extend the transaction outside etcd

An accepted transaction can authorize dispatch or publication, but it does not atomically execute an external training process, upload a checkpoint or make a remote database write. Those effects need their own reconciliation and idempotency contract. Conditional pointer publication protects a different, single-endpoint update. Retry and operation ledgers explain the remaining effect boundary. Acceptance here means the etcd control state changed under the correct combined predicates. It does not mean all downstream effects finished, the referenced artifact passed validation or every cache already observed the new revision.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles