Transactions in OceanBase Database are classified into distributed transactions and single-log stream transactions. The type of a transaction varies based on the session position of the transaction and the number of log stream 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 log stream.
The transaction involves only one log stream, but the log stream leader does not reside on the same server as the transaction session.
Single-log stream transactions
The transaction involves only one log stream, and the log stream 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.