Skip to the guide

Conflict resolution: last-write-wins, CRDTs, operational transforms

AdvancedConcept3 pages

Some copies accept writes without waiting for each other: regions in a multi-leader database, phones working offline, two people typing in one document. Sooner or later two of them change the same thing at once, and something has to decide the result. Interviewers ask about it in any design with offline edits, several write regions or live collaboration.

The family shopping list

A family keeps a shopping list on the fridge, and two of them copy it onto their phones before going out. One crosses off milk and adds eggs; the other adds bread and changes "apples" to "6 apples". Back home, they need one list. They could keep whichever phone was changed last, losing the other's changes. They could agree rules that always combine cleanly: every addition stays, and an item goes only if someone crossed off that very entry. Or, reading changes to each other line by line, each could adjust the other's line numbers: "add bread at line 3" becomes line 4, because eggs went in above.