System Design Patterns: From Fundamentals to Real Systems
Vote
0% completed
Two-Phase Commit
1. The Incident
The store launched gift cards, and customers can transfer balance to each other. Customer A (shard 2) sends $50 to customer B (shard 5): and the sharding lesson's warning now applies: this is one logical operation that must change two databases, and no single transaction covers both.
The first implementation does the obvious: subtract 50 on shard 2, then add 50 on shard 5. Two writes, one after the other. It works thousands of times
.....
.....
.....
Like the course? Get enrolled and start learning!