Unit 10 of 14 · about 3 hours · explain

Concurrent write conflicts and last-write-wins clock hazards

The Systems unit on consistency models and conflict resolution showed that last-write-wins can converge while losing an update. Here the new work is the stronger failure: a causally later write can lose too, because a wall-clock timestamp is not a dependency certificate.

You'll be able to

  • Separate causal conflicts from wall-clock and arrival order.
  • Derive which acknowledged update a last-write-wins policy discards under skew.
  • Choose between overwriting, retaining siblings and application merge from a stated invariant.

Covers

Concurrent write conflictsLast-write-wins clock hazards
1

Read

In this order, only the parts listed

0 of 1 done

  1. DDIA, 2nd edition: discarded writes and explicit conflict resolutionDDIA 2e - Chapter 6 Replication and Chapter 10 Consistency Sections

    Chapter 6, Replication: Dealing with Conflicting Writes, pp. 222 to 229; Detecting Concurrent Writes and The happens-before relation and concurrency, pp. 237 to 239

    Concentrate on Last write wins, Manual conflict resolution and Types of conflict. The CRDT discussion is review; stop before Capturing the happens-before relationship.

2

Focus on

  • LWW chooses the greatest tag under a deterministic total order, including a tie-break. That makes the choice reproducible, not necessarily physically latest or causally correct.
  • Concurrency means neither write depends on the other. Widely separated offline writes can still conflict; closely timed writes may be causally ordered.
  • Preserving siblings preserves evidence for resolution, not application invariants automatically. Resolving siblings concurrently can itself create more versions.
  • A uniqueness or capacity constraint can span different records. Absence of a same-key overwrite conflict does not establish that the application is correct.
Common mistakes · 3
  • Calling a total timestamp order a causal order or a proof of linearizability.
  • Changing equal-timestamp tie-breaking by replica or arrival order and thereby losing convergence.
  • Calling any lost user intent an implementation bug when the documented LWW contract explicitly permits discarding it.
3

Try it yourself

Closed-book, before checking anything

Use synthetic wall-clock tags, not elapsed-time measurements. A write of red has tag 120. Another client reads red, then writes blue with tag 110 because its clock is behind. With no other writes, apply a greatest-tag LWW merge in both delivery orders: both end at red, discarding the causally later blue write. Add equal-timestamp writes with different actor IDs and specify a stable tie-break. Finally choose a title-edit policy that may discard one edit and a cart-removal policy that must retain deletion intent; explain why one merge policy need not serve both.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Does the red/blue example require concurrent writes?Answer

    No. Reading red before writing blue makes blue causally later. Skewed physical tags can still make LWW discard it.

  2. 2.Does replacing wall time with a logical clock establish real-time order between independent clients?Answer

    No. A correctly propagated logical clock respects known causal dependencies. Independent events can be ordered arbitrarily, and real-time recency requires more protocol machinery.

  3. 3.If every replica keeps the same complete sibling set, has it resolved the application conflict?Answer

    Not necessarily. It has converged on the unresolved versions. The application still needs a meaningful resolution or a conflict-aware interface.

  4. 4.Can writes to different booking IDs violate the same room's reservation invariant?Answer

    Yes. Concurrent bookings can overlap even though they change different keys. Per-key conflict detection does not enforce a cross-record constraint.

You're done when

You reproduce the causally later losing write and defend whether each observed loss violates the implementation, the claimed contract or only the application's requirements.

Only when you can do this without notes.

Leads to

Notes

Resources · 1 for this unit, 15 more in the section

Also in this section