MySQL Blog Archive
For the latest blogs go to
2-Phase Commit in NDBCluster

This is a description of the simplest case of 2-phase commit (2PC) in NDBCluster: one transaction, containing a single insert, update or delete operation on a single row. The PREPARE phase of the 2PC is initiated by the API node (which is a mysqld or a NoSQL client) sending a TCKEYREQ to the Transaction Coordinator of a data node.


The TCKEYCONF is a confirmation that the transaction PREPARE phase has been successfully completed. The API node then sends a TC_COMMITREQ to initiate the COMMIT phase of the 2PC.


At this point in the 2PC, the primary copy of the row has the new value and the backup copy of the row is still locked. So the TC initiates a COMPLETE request to complete the COMMIT.


So at the end of the 2PC, both the primary and the backup copies of the row have been modified and unlocked, the redo PREPARE and COMMIT records have been written and the resources for the insert/update/delete operation have been released.