XA Transactions
1124
+----------+--------------+--------------+--------+
| formatID | gtrid_length | bqual_length | data |
+----------+--------------+--------------+--------+
| 7 | 3 | 3 | abcdef |
+----------+--------------+--------------+--------+
The output columns have the following meanings:
•
formatID
is the
formatID
part of the transaction
xid
•
gtrid_length
is the length in bytes of the
gtrid
part of the
xid
•
bqual_length
is the length in bytes of the
bqual
part of the
xid
•
data
is the concatenation of the
gtrid
and
bqual
parts of the
xid
13.3.7.2. XA Transaction States
An XA transaction progresses through the following states:
1. Use
XA START
to start an XA transaction and put it in the
ACTIVE
state.
2. For an
ACTIVE
XA transaction, issue the SQL statements that make up the transaction, and then
issue an
XA END
statement.
XA END
puts the transaction in the
IDLE
state.
3. For an
IDLE
XA transaction, you can issue either an
XA PREPARE
statement or an
XA
COMMIT ... ONE PHASE
statement:
•
XA PREPARE
puts the transaction in the
PREPARED
state. An
XA RECOVER
statement at this
point will include the transaction's
xid
value in its output, because
XA RECOVER
lists all XA
transactions that are in the
PREPARED
state.
•
XA COMMIT ... ONE PHASE
prepares and commits the transaction. The
xid
value will not be
listed by
XA RECOVER
because the transaction terminates.
4. For a
PREPARED
XA transaction, you can issue an
XA COMMIT
statement to commit and terminate
the transaction, or
XA ROLLBACK
to roll back and terminate the transaction.
Here is a simple XA transaction that inserts a row into a table as part of a global transaction:
mysql>
XA START 'xatest';
Query OK, 0 rows affected (0.00 sec)
mysql>
INSERT INTO mytable (i) VALUES(10);
Query OK, 1 row affected (0.04 sec)
mysql>
XA END 'xatest';
Query OK, 0 rows affected (0.00 sec)
mysql>
XA PREPARE 'xatest';
Query OK, 0 rows affected (0.00 sec)
mysql>
XA COMMIT 'xatest';
Query OK, 0 rows affected (0.00 sec)
Within the context of a given client connection, XA transactions and local (non-XA) transactions are
mutually exclusive. For example, if
XA START
has been issued to begin an XA transaction, a local
transaction cannot be started until the XA transaction has been committed or rolled back. Conversely,
if a local transaction has been started with
START TRANSACTION
, no XA statements can be used until
the transaction has been committed or rolled back.
Note that if an XA transaction is in the
ACTIVE
state, you cannot issue any statements that cause an
implicit commit. That would violate the XA contract because you could not roll back the XA transaction.
You will receive the following error if you try to execute such a statement:
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...