Conflicts, LWW & Version Vectors

Why last-write-wins loses data, version vectors for merge decisions, and read repair — not CRDT theory, just interview fluency.

3/5Overview: 20m

Last-write-wins (LWW)

Pick the value with the highest timestamp. Simple and dangerous:

  • Clock skew picks the wrong winner
  • Concurrent updates silently drop one write

Acceptable only when conflicts are impossible by domain rules or data is immutable.

Version vectors

Each replica tracks versions per replica ID. On read, compare vectors:

  • Equal → no conflict
  • One dominates → return newer
  • Concurrent → conflict — merge in application or surface to user

Read repair — during read quorum, client or coordinator writes back missing newer versions to stale replicas.

Merge strategies (verbal level)

StrategyWhen
Application mergeShopping cart, collaborative docs
DiscardMetrics where approximate is OK
Strong coordinationAvoid conflict via single leader

CRDTs are the deep end — mention "conflict-free replicated data types" if asked; not required for most backend loops.

Interview scenario

"Two users edit the same cell concurrently on different replicas. How do you detect it? How do you resolve?" → vector clocks or equivalent, then product-specific merge or last-writer with user confirmation.

Further Reading