Two writers that never saw each other need a merge rule, not a clock
Writes that never saw each other have no order, so no clock can resolve them; a version vector must detect them first.
Multi-leader replication makes concurrent writes a structural fact, not an edge case. Each leader accepts writes on its own, so two updates to one key arrive with no order between them. Last-write-wins picks the larger timestamp and silently discards the other write, so a clock turns a missing order into lost data. The fix is to detect concurrency first, then decide how to merge.
Each leader keeps a version vector: one counter per writer, incremented on every local write. When leader A accepts a write, it bumps its own entry, and when it receives a write from B, it records B's entry. Two values carry vectors. If every entry of one vector is greater than or equal to the other's, the later write saw the earlier one and supersedes it. If the entries cross, with one vector higher on one writer and lower on another, neither write saw the other. The system knows they are concurrent without consulting a clock, and it can keep both values instead of guessing which one to drop.
Suppose each leader records sales against a shared stock counter. Each leader updates its own copy with no coordination. When reconciliation keeps the larger value, the leader with the smaller total looks behind, and its sales vanish from the count. Nothing errors and nothing logs. The system believes it holds more stock than it does, and the oversell shows up later at the warehouse. Clocks make it worse: a jump of seconds can invert the order of two writes, so last-write-wins may keep the wrong value even when a vector would have flagged the conflict. The abstraction hides that replication delivers values, not meaning, and a timestamp cannot supply the meaning.
Ask first whether routing each key to one replica avoids the conflict, and price that against the throughput you wanted. If it does not, decide per data type. Counters and sets need a mergeable representation with version vectors underneath. Scalars need an explicit rule and a visible loser: store both values as siblings, show them, and let someone who knows the data choose. Never compare bare timestamps for a scalar. If you need one total order across all writes, no merge rule supplies it; you need a single append point, a consensus log. Write the rule down before the first conflict, because the first conflict is when the default runs.
- writers per vector
- one entry per writer
- entries for two writers
- 2
- clock inversion
- seconds
- siblings returned
- 2 values
- delivery order
- none
A version vector holds one counter per leader, so it grows with the number of writers, not the number of writes.
Two leaders need exactly two entries, and each leader increments only its own.
A jump of seconds can make a later write carry an earlier timestamp, so the wrong value wins.
Dynamo kept both concurrent values and handed them to application code, which merged the shopping cart.
Arrival order carries no causal information, so a value can reach a node before its cause.
The naive design lets every replica accept writes and resolves conflicts by picking the newer timestamp. It is simple to build, and it keeps the service answering during partitions, which is the reason to replicate across several nodes. Each replica responds without waiting for the others, so the first version looks correct in every test that writes to one node at a time.
The wall appears when two replicas accept different values for the same key. A timestamp is not an order: skewed clocks make one write look later than another even when no user ever observed that order. The losing value disappears with no error, so the shopping cart silently forgets an item someone just added.
Dynamo's answer was to attach a vector clock to each value. When two writes turned out to be concurrent, the system kept both as siblings and returned them to the application. The application, which understands a cart, merged the items rather than letting the store guess.
The lesson is that replication moves values but never meaning. A store can detect the conflict, but only code that knows the data can decide the merge. A clock cannot make that choice, and a timestamp only hides the decision it was supposed to make.