Conflict Resolution
Summary: The process of ensuring that concurrent updates to the same piece of data are eventually reconciled to a single, consistent value.
Sources: chapter5
Last updated: 2026-04-15
In multi-leader and leaderless replication systems, write conflicts can occur if two users concurrently update the same record (source: chapter5, p. 171). Conflict resolution is required to ensure that all replicas eventually converge to the same final state.
Conflict Detection
Conflicts are typically detected asynchronously when replicas exchange data. The simplest way to handle conflicts is to avoid them in the first place, for example by ensuring that all writes for a particular record go through the same leader (source: chapter5, p. 172).
Conflict Resolution Strategies
When conflicts cannot be avoided, they must be resolved. Common strategies include:
- last-write-wins (LWW): Each write is given a timestamp, and the write with the largest timestamp is kept. This is simple but can lead to data loss if two writes happened very close together (source: chapter5, p. 173).
- Convergent conflict resolution: Ensuring that all replicas eventually arrive at the same final value using techniques like version-vectors or crdts (source: chapter5, p. 173).
- Custom conflict resolution logic: Many databases allow the application to provide custom code that is executed when a conflict is detected. This code can resolve the conflict on write or on read (source: chapter5, p. 173).