Transactions in OceanBase Database are classified into distributed transactions and single-partition transactions. The type of a transaction varies based on the session position of the transaction and the number of partition leaders that are involved in the transaction.
Distributed transactions
A transaction is called a distributed transaction when it meets any of the following two conditions:
The transaction involves more than one partition.
The transaction involves only one partition, but the partition leader does not reside on the same server as the transaction session.
Single-partition transaction
A single-partition transaction involves only one partition, and the partition leader resides on the same server as the transaction session.
A distributed transaction has all the attributes of a transaction and must meet the atomicity, consistency, isolation, and durability (ACID) requirements. Distributed transactions are especially suitable for scenarios in which you want to change data on multiple servers and to ensure the atomicity.
In this case, a two-phase commit protocol is usually used. For more information about the two-phase commit protocol, see Two-phase commit.