1 ms
NTP’s accuracy on a LAN, at best
Tens of ms over the internet, and clocks step and pause. At 10,000 writes a second, that’s 10 writes per millisecond whose order is a guess.
Who picks the order?
Bad: Server timestamps
Inside the skew, a later write can carry a smaller stamp.
Good: One place hands out numbers
A log index, a partition offset, a version with compare-and-set. Nothing to skew.
Lamport’s clock: tick on every event, jump on receive
Messages carry the counter; receivers take max(local, received) + 1. If a caused b, L(a) < L(b). But a smaller number can’t prove cause.
Hybrid logical clocks stamp the largest wall time heard of, plus a counter. Replay the rider bug.
The fix
Dispatch carries PAID’s stamp, (.080, 0), so Node B must stamp above: (.080, 1). RIDER_ASSIGNED wins.
Office adds tea; the offline rep adds rice. Who was last?
Neither. Version vectors keep one counter per writer. All entries ≤ means older; mixed means concurrent: keep both and merge.
Mumbai counted 10 likes, Delhi 13. What’s the real total?
A G-Counter gives each region its own slot; merging keeps each slot’s maximum: 15. Adding the totals double counts; keeping the larger loses likes.
Pick the conflict rule per data type
- Profile field, “last seen”: last-writer-wins
- Likes: a G-Counter. Cart: an OR-Set
- Field-sales orders: merge rules plus human review
- Wallet balance: one home with consensus, never merged
Remember
Wall clocks can’t order writes across machines. Get order from one place, detect concurrency with version vectors, merge per data type.