CRDTs and Conflict Resolution

Conflict-Free Replicated Data Types (CRDTs) define data structures whose concurrent updates can be merged predictably under specified conditions. Examples include grow-only sets, counters, and registers with explicit conflict semantics. Some CRDTs merge states; others propagate operations.

The merge behavior must match product meaning. A mergeable counter is not automatically appropriate for inventory, because concurrent decrements must not violate a no-negative-stock invariant. Financial balances, reservations, and permissions need domain-specific correctness guarantees.

Before choosing a CRDT, specify offline duration, tombstone retention, replica membership, conflict semantics, and compaction. CRDTs simplify particular convergence problems; they do not replace authorization, validation, or business invariants.

Key Takeaways
  • CRDT guarantees apply to specific operations and data types.
  • Choose conflict semantics that match the domain.
  • Do not use eventual merge semantics for invariants they cannot preserve.