I find many readings that say 2PC is safe, which means it will either commit a transaction or rollback. More specifically, [If one commits, no one aborts; If one aborts, no one commits]. (http://www0.cs.ucl.ac.uk/staff/B.Karp/gz03/f2010/gz03-lecture6-2PC.pdf)
From Wikipedia, I know in commit phase, all processes will do the following things:
- The coordinator sends a commit message to all the participants.
- Each participant completes the operation and releases all the locks and resources held during the transaction.
- Each participant sends an acknowledgment to the coordinator.
- The coordinator completes the transaction when all acknowledgments have been received.
I wonder if in stage 1, the coordinator fails after it sent a message to several participants, which means some participants will receive the commit message while others will not. Then those who received will commit while others will still be blocked. So I think 2PC does not ensure safety here?
As the article from Wikipedia says:
Key word here is “permanently”. In your first link 2PC algorithm is also marked safe only for controller restarts not permanent dead.
So 2PC is safe while its components can interact (even with restarts, connection losses and other temporary problems).