Distributed Systems
Two phase commit
Two-phase commit lets several databases commit or abort together. A yes vote binds each participant, which is why a coordinator failure can leave locks held until a decision is found.
What you will be able to do
- Explain how the prepare and commit phases of two-phase commit work.
- Decide how to resolve an in-doubt transaction without splitting the outcome.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Distributed Systems
- Saga orchestrationAdvanced · 4 min
Explain saga orchestration, where a coordinator runs local steps and compensates completed steps in reverse order, and why its workflow state must be stored durably.
- Distributed transactionsAdvanced · 4 min
Explain two-phase commit, where participants prepare and a coordinator decides, and why prepared transactions hold locks and can block when the coordinator fails.
- CRDT merge rulesAdvanced · 4 min
CRDTs let replicas update independently and merge later without a coordinator. The merge rule decides which change wins, and a timestamp-based rule can silently drop a…
- Gossip membershipAdvanced · 4 min
Gossip membership spreads liveness news between random peers. SWIM detects failures with indirect probes and spreads changes on existing messages, trading detection…
- Backpressure propagationAdvanced · 4 min
Backpressure lets a slow consumer slow its producer by signaling demand upstream. Without a bound on the buffer between stages, the surplus turns into memory growth…
- FLP impossibilityAdvanced · 4 min
The FLP result says no deterministic consensus protocol can guarantee agreement in an asynchronous system if one process may crash. Practical systems keep safety and…