mariadb/mysql-test/suite/rpl/r/rpl_xa_empty_transaction.result
Brandon Nesterenko 42802ad66c MDEV-25616 XA PREPARE event group is not binlogged when..
the only query of the XA transaction is on a non-transactional table
errors out:

XA BEGIN 'x';
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1),(1);
XA END 'x';
XA PREPARE 'x';

The binlogging pattern is correctly started as expected with
the errored-out Query or its ROW format events, but there is
no empty XA_prepare_log_event group.
The following

XA COMMIT 'x';

therefore should not be logged either, but it does.

The bug is fixed with proper maintaining of a read-write binlog hton
property and use it to enforce correct binlogging decisions.
Specifically in the bug description case XA COMMIT won't be binlogged
in both when given in the same connection and externally after disconnect.
The same continue to apply to an empty XA that do not change any data in all
transactional engines involved.
2022-10-25 12:56:33 +03:00

1169 lines
38 KiB
Text

include/rpl_init.inc [topology=1->2->3]
connection server_1;
connection server_2;
connection server_3;
connection server_1;
#
# Test Case 1: An XA transaction without any statements should not be
# binlogged
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
#
# Test Case 2: An XA transaction consisting of a successfully rolled back
# statement should not be binlogged
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
#
# Test Case 3: An XA transaction with a statement that cannot be rolled
# back should be binlogged
connection server_1;
set @sav_binlog_format = @@binlog_format;
set @@binlog_format = row;
set @@global.binlog_format = row;
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
#
# Test Case 4: An XA transaction with multiple statements that can all
# be rolled back should not be binlogged
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
#
# Test Case 5: A mixed XA transaction consisting of one statement that
# can successfully be rolled back (first statement), and another that
# can not (second statement) should be binlogged
connection server_1;
set @sav_binlog_format = @@binlog_format;
set @@binlog_format = row;
set @@global.binlog_format = row;
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO ti VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
#
# Test Case 6: A mixed XA transaction consisting of one statement that
# cannot successfully be rolled back (first statement), and another that
# can (second statement) should be binlogged
connection server_1;
set @sav_binlog_format = @@binlog_format;
set @@binlog_format = row;
set @@global.binlog_format = row;
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO ti VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
#
# Test Case 7: An XA transaction consisting of two failed
# non-transactional statements should be binlogged
connection server_1;
set @sav_binlog_format = @@binlog_format;
set @@binlog_format = row;
set @@global.binlog_format = row;
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA COMMIT 'x';;
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA COMMIT 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
XA ROLLBACK 'x';;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connection server_2;
connection server_3;
connection server_1;
CREATE TABLE tm (a INT PRIMARY KEY) engine=myisam;
CREATE TABLE ti (a INT PRIMARY KEY) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
connect con1,localhost,root,,;
XA START 'x';
INSERT INTO tm VALUES (1),(1);;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tm VALUES (2),(2);;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
XA END 'x';
XA PREPARE 'x';
disconnect con1;
connection server_1;
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';;
ERROR XA100: XA_RBROLLBACK: Transaction branch was rolled back
include/save_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_1_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_1 should not binlog XA transaction]
connection server_2;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_2_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_2 should not binlog XA transaction]
connection server_3;
include/sync_with_master_gtid.inc
FLUSH LOGS;
# MYSQL_BINLOG server_3_datadir/binlog_filename --result-file=assert_file
include/assert_grep.inc [server_3 should not binlog XA transaction]
connection server_1;
DROP TABLE ti,tm;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
connection server_1;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
connection server_1;
include/rpl_end.inc
# End of rpl_xa_empty_transaction.test