wtf( )unctionsystem design, drawn
← all problemsAPI DesignHard

Two edits, one survivor

Two support agents open the same customer record. One fixes the phone number, the other fixes the address. Both save. The second save overwrites the first, and nobody is told anything went wrong.

Both requests were valid. Each sent the whole record as they loaded it, so the later write carried a stale copy of the field the earlier one had just changed.

Give the write a way to notice it's based on a stale read.
Components — tap one, then tap a slot on the diagram
!One agent's fix silently overwrote another's. Neither was told.

Outside every boundary: Customer record (FAILED: lost update), Agent B (edits the address), Agent A (edits the phone), an empty slot for the on the write Connections: Agent A calls on the write — version 7 (step 1) Agent B calls on the write — also version 7 (step 2) on the write calls Customer record — second one rejected (step 3)

Customer recordlost update
Agent Bedits the address
Agent Aedits the phone