What Are Replication Conflicts?
What you'll learn: How conflicts emerge when multiple database replicas simultaneously accept writes to the same piece of data.
The Core Problem
A replication conflict occurs when two or more replicas independently accept writes that modify the same data item before those changes can propagate to each other. When these divergent updates eventually meet, the system must decide which version to keep—or how to merge them.
Think of it like two editors working on the same Google Doc offline. Both make changes to the same paragraph. When they reconnect, whose edits win? That's a conflict.
When Conflicts Arise
Conflicts are possible in:
- Multi-leader replication: Multiple leaders accept writes simultaneously across different data centers
- Leaderless (Dynamo-style) replication: Any replica can accept writes directly
- Network partitions: Replicas operate independently when communication fails
Conflicts cannot occur in properly functioning single-leader replication because all writes funnel through one leader, creating a natural ordering.
Anatomy of a Conflict
- Client A writes
user.email = "alice@new.com"to Replica 1 - Client B writes
user.email = "alice@other.com"to Replica 2 (simultaneously) - Both replicas accept their writes locally
- Replication propagates both changes
- Each replica now sees two conflicting values for the same field
The system must resolve this: keep A's version, B's version, merge them, or ask the application to decide.
Why They Matter
Undetected or poorly handled conflicts lead to data loss and inconsistency across replicas. Users might see different values depending on which replica they query.
Key Takeaway: Replication conflicts are inevitable when multiple replicas accept concurrent writes to the same data; they require explicit detection and resolution strategies to maintain data integrity.