1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35019 Provide a way to enable "rollback XA on disconnect" behavior we had before 10.5.2

Implement variable legacy_xa_rollback_at_disconnect to support
backwards compatibility for applications that rely on the pre-10.5
behavior for connection disconnect, which is to rollback the
transaction (in violation of the XA specification).

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2024-10-10 20:52:45 +02:00
parent e927e28ebe
commit 8ae462a220
12 changed files with 152 additions and 1 deletions

View File

@@ -280,4 +280,28 @@ disconnect con1;
connection master;
xa commit '1';
drop table t2, t1;
# MDEV-35019 Provide a way to enable "rollback XA on disconnect" behavior we had before 10.5.2
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (3);
connect con1, localhost,root;
SET SESSION legacy_xa_rollback_at_disconnect= 1;
XA START '3';
INSERT INTO t1 VALUES (2);
XA END '3';
XA PREPARE '3';
disconnect con1;
connection master;
include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a
1
3
connection slave;
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a
1
3
connection master;
DROP TABLE t1;
include/rpl_end.inc

View File

@@ -289,6 +289,30 @@ disconnect con1;
connection master;
xa commit '1';
drop table t2, t1;
# MDEV-35019 Provide a way to enable "rollback XA on disconnect" behavior we had before 10.5.2
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (3);
connect con1, localhost,root;
SET SESSION legacy_xa_rollback_at_disconnect= 1;
XA START '3';
INSERT INTO t1 VALUES (2);
XA END '3';
XA PREPARE '3';
disconnect con1;
connection master;
include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a
1
3
connection slave;
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a
1
3
connection master;
DROP TABLE t1;
connection slave;
include/stop_slave.inc
SET @@global.gtid_pos_auto_engines="";

View File

@@ -434,3 +434,26 @@ disconnect con1;
connection master;
xa commit '1';
drop table t2, t1;
--echo # MDEV-35019 Provide a way to enable "rollback XA on disconnect" behavior we had before 10.5.2
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (3);
connect con1, localhost,root;
SET SESSION legacy_xa_rollback_at_disconnect= 1;
XA START '3';
INSERT INTO t1 VALUES (2);
XA END '3';
XA PREPARE '3';
--disconnect con1
--connection master
--source include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--connection slave
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;