The second commit phase usually does not contain a user code that may fail. Participating resource managers must ensure that a failure cannot occur. If this warranty is violated, no warranty can be provided by protocol.
Two-phase commit is trying to solve the Two Generals problem. There is no complete solution to this problem. TPC is an approximation.
Another way that a TPC can fail is in the case of a network partition. Some resource managers may perform a final commit, but some may not receive this message. Again, this problem is insoluble. Even repeated attempts cannot solve it.
You can even cause this problem in real conditions: run all the participating nodes in the stress test and pull the network cable at an arbitrary point. With a high probability, your distributed databases are now incompatible, because some commit messages are lost very uncomfortably.
source share