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.

prepare

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.

commit

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.

commit2

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.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter. * Time limit is exhausted. Please reload CAPTCHA.