Two-Phase Commit
Main idea - all resource managers (RMs) save a durable copy of the transaction’s updates before any of them commit.
If one RM fails after another commits, the failed RM can still commit after it recovers.
The protocol to commit transaction T
- Phase 1 - T’s coordinator asks all participant RMs to “prepare the transaction”. Participant RMs replies “prepared” after T’s updates are durable.
- Phase 2 - After receiving “prepared” from all participant RMs, the coordinator tells all participant RMs to commit.