← Lessons

quiz vs the machine

Gold1440

Databases

Data Sync Conflict Resolution

Deciding which write wins when the same record changes in two places.

5 min read · core · beat Gold to climb

When Both Sides Change

During a sync between two systems, the same record may be edited on both sides before they reconcile. Conflict resolution decides which version survives, or how to merge them, so the systems converge.

Common Strategies

  • Last write wins: keep the version with the newest timestamp. Simple, but a slightly skewed clock can silently drop a real edit.
  • Source of truth: one system always wins for a given field, removing ambiguity.
  • Field level merge: combine non overlapping field changes from each side so both edits survive.
  • Manual review: queue the conflict for a human when correctness matters more than automation.

Detecting Conflicts

To know a conflict happened, each side tracks a version or vector clock per record. If both versions advanced from the same base, they conflict and a rule applies. CRDTs go further, using data types whose merges are mathematically guaranteed to converge without a central referee.

Key idea

Sync conflict resolution detects concurrent edits with versions or vector clocks, then applies a rule like last write wins, field merge, or CRDT convergence so both systems agree.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the weakness of last write wins?

2. How are concurrent edits detected before resolving?

3. What do CRDTs guarantee for merges?