Debian Codegraph @

mysql-test/suite/rpl/t/rpl_xa_2pc_multi_engine.test

raw
1 #
2 # This test ensures binlog order is correct for multi-engine, two-phase XA
3 # transactions. MDEV-26652 exposed a race condition which would allow
4 # concurrent transactions which modify the same table record to binlog in
5 # the "opposite" order, i.e. what _should_ be:
6 # T1 XA PREPARE
7 # T1 XA COMMIT
8 # T2
9 #
10 # was binlogged as
11 # T1 XA PREPARE
12 # T2
13 # T1 XA COMMIT
14 #
15 # which would break replication.
16 #
17 # Note that the actual fix for this issue was done with MDEV-21117.
18 #
19 # References:
20 # MDEV-26652: xa transactions binlogged in wrong order
21 # MDEV-21117: refine the server binlog-based recovery for semisync
22 #
23 source include/have_binlog_format_row.inc;
24 source include/have_innodb.inc;
25 source include/master-slave.inc;
26
27 --connection master
28 create table t1 (a int primary key, b int) engine=innodb;
29 insert t1 values (1,1),(3,3),(5,5),(7,7);
30 create table t2 (m int) engine=aria;
31
32
33 --echo # Create multi-engine, two-phase XA transaction (T1)
34 xa start '1';
35 insert t2 values (1);
36 update t1 set b=50 where b=5;
37 xa end '1';
38
39 # Aria doesn't support XA PREPARE, so disable warnings
40 --disable_warnings
41 xa prepare '1';
42 --enable_warnings
43
44 --echo # Create T2
45 --connection server_1
46 --send update t1 set b=10 where a=5
47
48 --connection master
49 xa commit '1';
50
51 --connection server_1
52 --reap
53 --source include/save_master_gtid.inc
54
55 --echo # This would hang prior to MDEV-21117
56 --connection slave
57 --source include/sync_with_master_gtid.inc
58
59 --connection master
60 drop table t1, t2;
61
62 --source include/rpl_end.inc
63 --echo # End of rpl_xa_2pc_multi_engine.test