Hypothetical scenario. Northwind retries a cleanup occurrence while an older product update is redelivered. Dev gives each attempt a new timestamp-based identifier and sorts the records. Priya can no longer tell which attempts belong to the same obligation.
Priya: “Which identifier survives a retry?”
Maya: “And what evidence says one change caused or followed another?”
Separate logical identity, attempt identity, physical time and causal order. Each answers a different recovery question. Keep the scheduled occurrence and product update distinct so the pipeline checkpoint can explain both repeated delivery and late information.
Which thing needs this identity?
A product edit, a scheduled occurrence, a publication intent and a delivery attempt are different things. Each may need an identifier, but those identifiers answer different questions. A retry should retain the original logical operation identity while optionally acquiring a new attempt identity for diagnostics.
For a search projection, the selected operation can be identified by product identity, source version and projection schema version. Delivering that operation again does not create another product edit. A new projection schema version can represent genuinely different work even when it reads the same source version.
A schedule occurrence similarly retains the intended scheduled instant and schedule identity. A delayed start time belongs to the attempt record. Replacing occurrence identity with the time at which a worker happened to run makes recovery create new logical obligations instead of continuing the old one.
Uniqueness is a generation contract
A central sequence can allocate distinct numbers within its coordinated scope. Independent generators can avoid that immediate dependency by using an appropriate identifier scheme, but they introduce assumptions about generation, namespace and collision handling. A random-looking label is not an explanation of those assumptions.
RFC 9562 defines UUID formats and relevant generation considerations. A UUID is not automatically a timestamp, an authorization token or a universal proof that a business action has never occurred before. The application still needs to bind it to the operation’s meaning.
For UUID version 4, the format reserves four version bits and two variant bits within the 128-bit representation, leaving 128 − 4 − 2 = 122 random bits in the specified layout. That describes the format; correct generation and collision policy still matter. Do not replace those requirements with an unsupported claim of mathematical impossibility.
Work a causal graph with actual clock values
Hypothetical scenario. Start two processes with scalar clocks at zero and vector clocks [0,0]. Process A emits event a: scalar 1, vector [1,0]. Independently B emits b: scalar 1, vector [0,1]. Neither event contains information about the other, so they are concurrent.
| Event | Lamport | Vector |
|---|---|---|
| a at A | 1 | [1,0] |
| b at B | 1 | [0,1] |
| s sent by A | 2 | [2,0] |
| receive at B | 3 | [2,2] |
A sends after a, giving send event s scalar 2 and vector [2,0]. B receives s after b. Updating by the receive rules gives scalar max(1,2) + 1 = 3 and vector [2,2], counting B's receive event. Now s precedes that receive causally. The vectors [1,0] and [0,1] remain incomparable componentwise, exposing the original concurrency.
A scalar tie-breaker such as process identity can choose a total presentation order for a and b, but it does not manufacture a causal edge. Likewise, a larger Lamport timestamp does not prove that its event learned about every smaller timestamp. Physical-time uncertainty and logical clocks answer different questions; retain an operation identity independently from whichever order the display uses.
Use a small identifier space to see the arithmetic
Hypothetical worked example. Choose a toy eight-bit random namespace, giving 2⁸ = 256 possible values. Draw ten identifiers independently and uniformly, allowing repeats. The number of distinct pairs of draws is 10 × 9 ÷ 2 = 45.
Each pair has matching probability 1 ÷ 256 under the selected model. The expected number of matching pairs is 45 ÷ 256 = 0.17578125. This is an expected pair count, not the probability that at least one collision occurs. Several matching pairs can belong to the same repeated value, and the events are not all disjoint.
The toy namespace is intentionally small enough to inspect. It is not a risk estimate for correctly generated UUIDs. Its purpose is to expose which assumption a random-identifier argument uses and why an expected count must not be mislabeled as a measured failure percentage.
Physical time has an observation boundary
Physical timestamps describe readings from clocks. Clocks can disagree, be adjusted or be observed at different points in a workflow. A producer’s event timestamp and the consumer’s processing timestamp can legitimately differ. Sorting one field cannot by itself reconstruct every dependency between events.
A time-ordered identifier format can be useful for locality or approximate chronological inspection under its documented generation assumptions. It does not mean two independent clocks agree, or that a larger identifier represents a permitted later write. Keep the source-version and ownership-generation rules from the earlier lessons.
Causality follows information
An event can causally precede another when local execution order or a communication path carries information from the first to the second. A send precedes its matching receive in that relationship. Two events with no such dependency may be concurrent even when their wall-clock fields look different.
A Lamport logical clock advances locally and, on receiving a message, advances beyond both its current value and the message’s value. That construction respects the direction of causality: a causally earlier event has a smaller logical timestamp. The reverse implication is not valid; a smaller timestamp alone does not prove a causal path.
For a selected example, process A has clock 3 and advances to 4 when sending. Process B has clock 7 when receiving that message, so it sets max(7, 4) + 1 = 8. The send’s 4 is less than the receive’s 8. Another independent event with timestamp 5 is not proven to precede the receive merely because five is smaller than eight.
Compare histories before declaring a conflict resolved
Hypothetical scenario. Northwind’s two projection writers A and B start with vector [0, 0]. Each component counts events observed from its corresponding writer. Before a local event, a writer increments its own component. A’s edit-and-send event a receives [1, 0]; independently, B’s edit b receives [0, 1]. Neither vector is componentwise less than or equal to the other. Under this fixed-writer model, the edits are concurrent: neither carries evidence of observing the other.
A’s message reaches B. B merges by componentwise maximum, giving max([0, 1], [1, 0]) = [1, 1], then increments its own component for the receive event to obtain [1, 2]. Now [1, 0] is componentwise no greater than [1, 2], with at least one strict inequality. The later event incorporates a’s history. A version comparison has gained information that sorting scalar timestamps cannot recover.
The Cambridge distributed-systems notes, section 4.1 explain vector clocks alongside Lamport clocks. This exercise assumes distinct, stable writer identities and that the vector accompanies every modeled communication. Dropping causal dependencies or reusing a component after a restart can invalidate the comparison. A variable writer population also needs a representation and retirement policy; a two-entry vector is not an unrestricted production format.
Lamport’s ordering paper gives the underlying happens-before relation: local order, matching send/receive, and their transitive consequences. A scalar clock preserves causal precedence in one direction. Vector comparison can expose concurrency under the stated tracking model, but neither clock decides what concurrent business edits mean. If a withdraw action and a description change are concurrent, the application must define whether to merge fields, retain competing versions or reject a transition pending review.
Choose scalar ordering when that is all the operation needs. Pay for causal metadata when distinguishing observed succession from concurrency changes the result. A hybrid logical clock combines physical-time information with a logical component; its convenient ordering still does not supply a vector’s concurrency evidence. Keep source versions and authority checks separate from every timestamp format.
Could a deterministic tie-breaker safely choose b over a?
It can choose a reproducible order, but that does not establish that b observed a or is permitted to reverse it. In this example [1, 0] and [0, 1] are incomparable. State a merge policy for that concurrency instead of inventing a causal relationship.
A total order is another choice
A total order places every pair in an order, including events that are causally independent. A deterministic tie-breaker can make a sort reproducible, but does not turn that sorting rule into agreement about which writes were durably accepted. Consensus and the replicated-log lesson later address that separate problem.
Northwind often needs less than a global order. Product-version processing can follow a per-product contract, while unrelated products proceed independently. A global sequence introduces coordination and throughput consequences that should be justified by a real cross-product requirement.
In the wild: UUID formats specify their fields
RFC 9562 supplies a public format and generation reference for UUIDs. Use it to check what an identifier encodes and what the selected version promises. It does not specify Northwind’s retry-retention duration, product-version policy or worker-authority protocol.
Hypothetical failure scenario. A redelivered search update receives a fresh UUID and is treated as a new operation. The target no longer recognizes its prior completion. A timestamp sort then lets an older source snapshot overwrite a newer one because the retry happened later.
Preserve logical identity across attempts and compare source versions according to the selected projection contract. Record attempt timestamps for diagnosis without granting them authority over the business history. Two useful metadata fields became harmful only when the application asked them to answer the wrong question.
Choose only the identity and order required
Use operation identities to connect retries and reconciliation. Use attempt identities to explain execution. Use clocks under stated observation assumptions, and select causal or total ordering only where the application requires it. A single attractive identifier should not silently serve all these roles.
Northwind can now assemble its background pipeline with explicit accepted intent, delivery recovery, subscription progress, scheduled ownership and event identity. The next checkpoint introduces worker loss and replay together, then asks which records establish completion and which still represent uncertainty.
Challenge the proposed mechanism
A later independent event has Lamport value 4. Does that prove it observed the receive with value 3?
Reveal the design reasoning
No. Scalar order is necessary along causality but its converse is false. Show a message or local-order path, or use the selected causal metadata. A unique event identifier provides neither proof.
Decision and reconsideration: Keep event identity, causal evidence and display order separate. Select vector metadata only where concurrency detection is required.
Ask what the label proves
Should a retried search operation receive a new logical operation identity?
Preserve the obligation
No. Retain the original product/source/schema identity. A distinct attempt identifier can record the new execution without redefining the business action.
Does the toy value 0.17578125 equal the probability of any collision?
Name the derived quantity
No. It is the expected number of matching pairs under the selected uniform independent draws. A probability of at least one collision is a different calculation.
A logical timestamp is smaller than another. Does that prove causality?
Keep the implication in its valid direction
No. The clock construction respects causal order, but independently occurring events can also have ordered clock values. Trace the information path before claiming a dependency.
Northwind now has names for accepted work, occurrences and attempts. Page 24 uses those identities to explain a pipeline containing duplicate publication, a lost acknowledgement and an older update arriving late.
Northwind decision log
Keep logical operations and execution attempts separately identifiable.
Use source versions and authority generations for their declared purposes.
Distinguish clock order, causal order and accepted history during recovery.
Go deeper: independent execution and order
- Book chapter: Concurrency in Go, chapter 2: Modeling Your Code: Communicating Sequential Processes — Katherine Cox-Buday. Reason about communication and execution independently of one wall clock.
- Book chapter: The same book, chapter 5: Concurrency at Scale — Katherine Cox-Buday. Connect cancellation and heartbeats with the limits of execution observations.
- Video lecture: Causality and happens-before — Martin Kleppmann. Follow the implication between communication and logical time.
- Primary document: Universally Unique IDentifiers (UUIDs) — IETF / RFC Editor. Check identifier fields and generation considerations.