Conflict Resolution in Practice
What you'll learn: How real distributed databases like Dynamo, Cassandra, and Riak actually resolve conflicts in production systems.
Seeing Theory in Action
You've learned various conflict resolution strategies — now let's see how battle-tested databases implement them in the wild.
Amazon Dynamo's Shopping Cart Strategy
Dynamo (the inspiration for DynamoDB) uses vector clocks to track causality and offers multiple resolution paths:
- For shopping carts, conflicts are merged — if you add an item on mobile while adding another on web, both items appear
- The application handles resolution using custom merge logic
- Philosophy: preserve all customer actions, never silently drop data
Apache Cassandra's LWW Approach
Cassandra takes a simpler route with Last-Write-Wins based on timestamps:
- Each write carries a microsecond-precision timestamp
- Conflicts are resolved automatically during reads and compaction
- Tunable consistency via quorum reads (
R + W > N) - Trade-off: accepts data loss for operational simplicity — great for metrics, not for bank accounts
Riak's Sibling Strategy
Riak exposes conflicts directly to applications as siblings:
- Concurrent writes create multiple object versions
- Applications must explicitly resolve or Riak keeps all versions
- Supports both vector clocks and simpler dotted version vectors
- Philosophy: developers know their data best — database provides tools, not opinions
Pattern Recognition
Notice the spectrum? Dynamo merges proactively, Cassandra decides automatically, Riak defers to applications. Your choice depends on:
- Data semantics (counters vs shopping carts vs user profiles)
- Acceptable data loss
- Application complexity tolerance
Key Takeaway: Production systems rarely use one conflict strategy universally — Dynamo merges carts but might use LWW for session data; Cassandra offers pluggable strategies. Match the resolution approach to each data type's real-world meaning.