1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-21659 XA rollback foreign_xid is allowed inside active XA

MDEV-21854 xa commit `xid` one phase for already prepared transaction must always error out

Added state and one-phase option checks to XA "external" commit/rollback
branches. While the XA standard does not prohibit it,
Commit and Rollback of an XA external to the current ongoing transaction
is not allowed; after all the current transaction may rollback
to not being able to revert that decision.
This commit is contained in:
Andrei Elkin
2020-03-02 17:12:35 +02:00
parent f4f6558666
commit dd3ffdbd92
3 changed files with 84 additions and 4 deletions

View File

@ -72,7 +72,7 @@ xa prepare 'testa','testb';
xa recover;
--error ER_XAER_NOTA
--error ER_XAER_OUTSIDE
xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';
@ -505,6 +505,33 @@ XA ROLLBACK 'Я_упaлa_c_сеновалаормозила_головой';
SET NAMES default;
DROP TABLE t1;
--echo #
--echo # MDEV-21659 XA rollback foreign_xid is allowed inside active XA
--echo # MDEV-21854 - xa commit one phase for already prepared transaction
--echo # must always error out
--echo #
BEGIN;
--error ER_XAER_OUTSIDE
XA COMMIT 'unknown';
--error ER_XAER_OUTSIDE
XA COMMIT 'unknown' ONE PHASE;
BEGIN;
--error ER_XAER_OUTSIDE
XA ROLLBACK 'unknown';
ROLLBACK;
XA START 'xid1';
--error ER_XAER_OUTSIDE
XA COMMIT 'unknown';
--error ER_XAER_OUTSIDE
XA COMMIT 'unknown' ONE PHASE;
--error ER_XAER_OUTSIDE
XA ROLLBACK 'unknown';
XA END 'xid1';
XA PREPARE 'xid1';
--error ER_XAER_INVAL
XA COMMIT 'xid1' ONE PHASE;
XA ROLLBACK 'xid1';
--echo #