Two-phase commit (2PC)
A coordinator asks everyone if they're ready (prepare) and, if all say yes, asks them to commit.
Example
If 1 of 5 nodes says 'not ready', the coordinator aborts on all 5.
Test yourself: Two-phase commit (2PC)
Distributed transactions
2PC's first phase is called ___.
In prepare, each of the 3 databases says whether it can do its part. Only with 3 «yes» votes does phase 2, commit, happen.
Distributed transactions
In 2PC, the node that collects votes and decides is called the ___.
1 coordinator for N participants: with 3 databases, it collects 3 votes.
Distributed transactions
Participants said 'prepared' and the coordinator crashed. What happens?
2PC is blocking: without a coordinator, the 3 participants can wait minutes with data locked.
0/3
â–¶ Play