summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/rpl/t/rpl_xa_interleave.test
blob: 3941604c85560df4123f6c2a825358f947e12387 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
--source include/have_tokudb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/master-slave.inc

CREATE TABLE t1(`a` INT) ENGINE=TokuDB;

## XA interleave commit
--connection master
XA START 'x1';
INSERT INTO t1 VALUES (1);
XA END 'x1';
XA PREPARE 'x1';

--connection master1
BEGIN;
INSERT INTO t1 VALUES (10);
COMMIT;
XA START 'y1';
INSERT INTO t1 VALUES (2);
XA END 'y1';
XA PREPARE 'y1';

--connection master
XA COMMIT 'x1';

--connection master1
XA COMMIT 'y1';

--connection master
BEGIN;
INSERT INTO t1 VALUES (11);
COMMIT;
XA START 'x2';
INSERT INTO t1 VALUES (3);
XA END 'x2';
XA PREPARE 'x2';

--connection master1
XA START 'y2';
INSERT INTO t1 VALUES (4);
XA END 'y2';
XA PREPARE 'y2';

--connection master
XA COMMIT 'x2';

--connection master1
XA COMMIT 'y2';

## XA interleave rollback
--connection master
XA START 'x1';
INSERT INTO t1 VALUES (1);
XA END 'x1';
XA PREPARE 'x1';

--connection master1
BEGIN;
INSERT INTO t1 VALUES (10);
COMMIT;
XA START 'y1';
INSERT INTO t1 VALUES (2);
XA END 'y1';
XA PREPARE 'y1';

--connection master
XA ROLLBACK 'x1';

--connection master1
XA ROLLBACK 'y1';

--connection master
BEGIN;
INSERT INTO t1 VALUES (11);
COMMIT;
XA START 'x2';
INSERT INTO t1 VALUES (3);
XA END 'x2';
XA PREPARE 'x2';

--connection master1
XA START 'y2';
INSERT INTO t1 VALUES (4);
XA END 'y2';
XA PREPARE 'y2';

--connection master
XA ROLLBACK 'x2';

--connection master1
XA ROLLBACK 'y2';

--connection master

--sync_slave_with_master

--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
--let $diff_tables= master:test.t1, slave:test.t1
--source include/diff_tables.inc

--connection master
DROP TABLE t1;
--source include/rpl_end.inc