This topic describes how distributed transactions of DRDS work.
Distributed transactions use two-phase commit (2PC) to ensure the atomicity and consistency of transactions.
A 2PC transaction is divided into the prepare and commit phases.
- In the prepare phase, data nodes prepare all the resources such as resource locking and logging that are required for transaction commitment.
- In the commit phase, each data node actually commits transactions.
When you commit a distributed transaction, the DRDS server, as a transaction manager, sends a commit request to each data node only after all data nodes (ApsaraDB RDS for MySQL instances) have their resources prepared.