I am new to distributed transaction thing, studying how two-phase commit works across a distributed transaction in micro-services architecture. As per my understanding, 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.
But 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 fails at commit (say due to some database constraint or connection timeout)
All other nodes commit successfully, but now the distributed transaction is corrupt
In short, what does it mean when the nodes say that they are ready to commit?
I am assuming each node is running a normal database that doesn't know anything about distributed transactions.