Debian Codegraph @

mysql-test/suite/storage_engine/trx/xa.test

raw
1 #
2 # Basic XA transactions syntax
3 #
4
5 --source ../have_engine.inc
6 --source support_xa.inc
7
8 # Save the initial number of concurrent sessions
9 --source include/count_sessions.inc
10
11 --disable_warnings
12 DROP TABLE IF EXISTS t1;
13 --enable_warnings
14
15 --connect (con1,localhost,root,,)
16 --connect (con2,localhost,root,,)
17
18 --connection con1
19 --let $create_definition = a $int_col
20 --source ../create_table.inc
21
22 --connection con2
23
24 # Two-phase COMMIT
25
26 XA START 'xa1';
27 INSERT INTO t1 (a) VALUES (1);
28
29 --connection con1
30 --sorted_result
31 SELECT a FROM t1;
32
33 --connection con2
34 INSERT INTO t1 (a) VALUES (2);
35 XA END 'xa1';
36
37 --connection con1
38 --sorted_result
39 SELECT a FROM t1;
40
41 --connection con2
42 XA PREPARE 'xa1';
43
44 --connection con1
45 --sorted_result
46 SELECT a FROM t1;
47
48 --connection con2
49 XA RECOVER;
50 XA COMMIT 'xa1';
51
52 --connection con1
53 --sorted_result
54 SELECT a FROM t1;
55
56 # One-phase COMMIT
57
58 --connection con2
59 XA START 'xa2';
60 INSERT INTO t1 (a) VALUES (3);
61
62 --connection con1
63 --sorted_result
64 SELECT a FROM t1;
65
66 --connection con2
67 INSERT INTO t1 (a) VALUES (4);
68 XA END 'xa2';
69
70 --connection con1
71 --sorted_result
72 SELECT a FROM t1;
73
74 --connection con2
75 XA COMMIT 'xa2' ONE PHASE;
76
77 --connection con1
78 --sorted_result
79 SELECT a FROM t1;
80
81 # Rollback
82
83 --connection con2
84 XA START 'xa3';
85 INSERT INTO t1 (a) VALUES (5);
86
87 --connection con1
88 --sorted_result
89 SELECT a FROM t1;
90
91 --connection con2
92 INSERT INTO t1 (a) VALUES (6);
93 XA END 'xa3';
94
95 --connection con1
96 --sorted_result
97 SELECT a FROM t1;
98
99 --connection con2
100 XA PREPARE 'xa3';
101
102 --connection con1
103 --sorted_result
104 SELECT a FROM t1;
105
106 --connection con2
107 XA ROLLBACK 'xa3';
108
109 --connection con1
110 --sorted_result
111 SELECT a FROM t1;
112
113 DROP TABLE t1;
114
115 --source ../cleanup_engine.inc
116