I am studying how two-phase commit works across a distributed transaction. It is my understanding that in the last part of the phase the transaction coordinator asks each node whether it is ready to commit. If everyone agreed, then it tells them to go ahead and commit.
What prevents the following failure?
- All nodes respond that they are ready to commit
- The transaction coordinator tells them to "go ahead and commit" but one of the nodes crashes before receiving this message
- All other nodes commit successfully, but now the distributed transaction is corrupt
- It is my understanding that when the crashed node comes back, its transaction will have been rolled back (since it never got the commit message)
I am assuming each node is running a normal database that doesn't know anything about distributed transactions. What did I miss?