File: rpl_xa_2pc_multi_engine.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (63 lines) | stat: -rw-r--r-- 1,542 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# This test ensures binlog order is correct for multi-engine, two-phase XA
# transactions. MDEV-26652 exposed a race condition which would allow
# concurrent transactions which modify the same table record to binlog in
# the "opposite" order, i.e. what _should_ be:
#   T1 XA PREPARE
#   T1 XA COMMIT
#   T2
#
# was binlogged as
#   T1 XA PREPARE
#   T2
#   T1 XA COMMIT
#
# which would break replication.
#
# Note that the actual fix for this issue was done with MDEV-21117.
#
# References:
#   MDEV-26652: xa transactions binlogged in wrong order
#   MDEV-21117: refine the server binlog-based recovery for semisync
#
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
source include/master-slave.inc;

--connection master
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1),(3,3),(5,5),(7,7);
create table t2 (m int) engine=aria;


--echo # Create multi-engine, two-phase XA transaction (T1)
xa start '1';
insert t2 values (1);
update t1 set b=50 where b=5;
xa end '1';

# Aria doesn't support XA PREPARE, so disable warnings
--disable_warnings
xa prepare '1';
--enable_warnings

--echo # Create T2
--connection server_1
--send update t1 set b=10 where a=5

--connection master
xa commit '1';

--connection server_1
--reap
--source include/save_master_gtid.inc

--echo # This would hang prior to MDEV-21117
--connection slave
--source include/sync_with_master_gtid.inc

--connection master
drop table t1, t2;

--source include/rpl_end.inc
--echo # End of rpl_xa_2pc_multi_engine.test