Read committed, Repeatable read, and Serializable.begin; # Start a transaction... # Cross-set INSERT, DELETE, UPDATE, SELECT, and other non-DDL operationscommit; # Commit the transaction
xa begin ''; # Start an XA transaction. The transaction identifier is generated by the system, so you can pass in an empty string.... # Cross-set INSERT, DELETE, UPDATE, SELECT, and other non-DDL operationsselect gtid(); # Get the XA transaction identifier, which is assumed as 'xid' in the following statementsxa prepare 'xid'; # Prepare the transactionxa commit/rollback 'xid'; # Commit or roll back the transaction
select gtid(): this API is used to get the globally unique identifier of the distributed transaction. If no value is returned, the transaction is not a distributed transaction.select gtid_state("Globally unique identifier of the distributed transaction"): this API is used to get the transaction status (in 3 seconds by default) after an exception occurs in committing the transaction. The following status may be returned:xa boost 'Globally unique identifier of the distributed transaction' : after an exception occurs in committing a non-XA transaction, the transaction will be automatically committed or rolled back by the backend component in a certain period of time (30 seconds by default). If you are unwilling to wait for such a long time, you can repeatedly call this API to make the system commit or roll back the transaction in a timely manner. This API will return the status of the transaction (i.e., committed or rolled-back).xa lockwait: this API is used to show the wait-for relationship between the distributed transactions. You can convert it to a graph using the dot tool. xa show: this API is used to show transactions that are active on the proxy.Feedback