Conflict-free merges in 90 seconds
This page is part of the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at conflict-free-merges.md, and llms.txt lists every page.A G-Set merges concurrent additions by taking their union, so both clusters converge on the same set.
Transcript
Opening
Values that merge showed how a chosen data type can resolve concurrent writes; now watch one merge in a set.
G-Set merge
A plain write uses last-writer-wins: if two clusters write the same key, the later timestamp keeps its value and silently replaces the other.
A G-Set has a different rule. It only grows: you can add an element, but cannot remove one. Start with an empty set. Cluster A adds alice while cluster B, without seeing that change, adds bob.
Their sets are {alice} and {bob}; neither contains the other. When they merge, each takes the union, keeping every element from both sets.
Now deliver bob's add again. Both clusters hold {alice, bob}; the union gives the same result regardless of delivery order, and repeating an add does not duplicate an element.
Set union is commutative, associative and idempotent: swapping, regrouping or repeating a merge leaves the result unchanged. That is why both sides converge without choosing a winner.
Use a G-Set for append-only membership, such as seen identifiers or tags. If your data needs removals, choose an OR-Set or RW-Set instead; those define removal semantics.
Back on Build, next: Scans, filters and cursors. The links are on this episode's page in the documentation.
Where next
- Back to Build: Scans, filters and cursors
- The pages it introduces: CRDT primitives and state primitives