summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/rpl/r/rpl_xa.result
blob: 061c7b360d03e2e55ae3438a3e327e09d7d77ed4 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int, b int) engine=InnoDB;
insert into t1 values(0, 0);
xa start 't';
insert into t1 values(1, 2);
xa end 't';
xa prepare 't';
xa commit 't';
connection slave;
include/diff_tables.inc [master:t1, slave:t1]
connection master;
xa start 't';
insert into t1 values(3, 4);
xa end 't';
xa prepare 't';
xa rollback 't';
connection slave;
include/diff_tables.inc [master:t1, slave:t1]
connection master;
SET pseudo_slave_mode=1;
create table t2 (a int) engine=InnoDB;
xa start 't';
insert into t1 values (5, 6);
xa end 't';
xa prepare 't';
xa start 's';
insert into t2 values (0);
xa end 's';
xa prepare 's';
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
xa recover;
formatID	gtrid_length	bqual_length	data
1	1	0	s
1	1	0	t
connection master;
xa commit 't';
xa commit 's';
SET pseudo_slave_mode=0;
connection slave;
include/diff_tables.inc [master:t1, slave:t1]
include/diff_tables.inc [master:t2, slave:t2]
connection master;
*** At the start of read-only section gtid list is:
flush logs;
show binlog events in 'master-bin.000002' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000002	#	Gtid_list	1	#	[0-1-11]
set @query1="select 1";
set @query2="select count(*) into @s2 from t1";
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'ro_2';
select count(*) into @s2 from t1;
xa end 'ro_2';
xa prepare 'ro_2';;
disconnect master_ro_2;
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'ro_1';
select 1;
1
1
xa end 'ro_1';
xa prepare 'ro_1';;
disconnect master_ro_1;
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'ro_2';
select count(*) into @s2 from t1;
xa end 'ro_2';
xa prepare 'ro_2';;
disconnect master_ro_2;
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'ro_1';
select 1;
1
1
xa end 'ro_1';
xa prepare 'ro_1';;
disconnect master_ro_1;
*** 2 prepared xa:s must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
1	4	0	ro_1
1	4	0	ro_2
*** Zero prepared xa:s must be in the list:
xa recover;
formatID	gtrid_length	bqual_length	data
*** At the end of read-only section gtid list has 0 more compare with previous check:
flush logs;
show binlog events in 'master-bin.000003' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000003	#	Gtid_list	1	#	[0-1-11]
create database test_ign;
set @@sql_log_bin = 0;
create table test_ign.t (a int) engine=InnoDB;
set @@sql_log_bin = 1;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'rw_no_binlog';
insert into test_ign.t set a=1;
xa end 'rw_no_binlog';
xa prepare 'rw_no_binlog';;
disconnect master_rw_no_binlog;
*** rw_no_binlog must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
1	12	0	rw_no_binlog
*** Zero must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
*** At the end of --binlog-ignore-db section gtid list has 2 more:
flush logs;
show binlog events in 'master-bin.000004' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000004	#	Gtid_list	1	#	[0-1-13]
connection master;
create table t3 (a int) engine=innodb;
*** the disconnected prepare case
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
set @@binlog_format=statement;
xa start 'rw_binlog_only';
delete from t3;
xa end 'rw_binlog_only';
xa prepare 'rw_binlog_only';
disconnect master_rw_binlog_only;
connection master;
*** rw_binlog_only must be in the list:
xa recover;
formatID	gtrid_length	bqual_length	data
1	14	0	rw_binlog_only
*** Zero must be in the list:
xa recover;
formatID	gtrid_length	bqual_length	data
*** the same connection complete case.
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
set @@binlog_format=statement;
xa start 'rw_binlog_only';
delete from t3;
xa end 'rw_binlog_only';
xa prepare 'rw_binlog_only';
*** rw_binlog_only must be in the list:
xa recover;
formatID	gtrid_length	bqual_length	data
1	14	0	rw_binlog_only
disconnect master_rw_binlog_only;
*** Zero must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
*** At the end of ineffective in engine section gtid list has 5 more:
flush logs;
show binlog events in 'master-bin.000005' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000005	#	Gtid_list	1	#	[0-1-18]
create table tm (a int) engine=myisam;
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'rw_myisam';
insert into tm set a=1;
xa end 'rw_myisam';
xa prepare 'rw_myisam';;
disconnect master_rw_myisam;
connection master;
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
xa start 'rw_myisam';
insert into tm set a=1;
xa end 'rw_myisam';
xa prepare 'rw_myisam';;
disconnect master_rw_myisam;
*** rw_myisam prepared must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
1	9	0	rw_myisam
*** Zero prepared xa:s must be in the list:
xa recover;
formatID	gtrid_length	bqual_length	data
*** At the end of MyISAM "xa" section gtid list has 7 more compare with previous check:
flush logs;
show binlog events in 'master-bin.000006' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000006	#	Gtid_list	1	#	[0-1-25]
connect  master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,;
set @@session.sql_log_bin = OFF;
xa start 'skip_binlog';
insert into t2 values(1);
xa end 'skip_binlog';
xa prepare 'skip_binlog';
disconnect master_skip_binlog;
*** skip_binlog must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
1	11	0	skip_binlog
set @@session.sql_log_bin = OFF;
xa rollback 'skip_binlog';
set @@session.sql_log_bin = ON;
include/save_master_gtid.inc
*** Zero must be in the list:
connection master;
xa recover;
formatID	gtrid_length	bqual_length	data
*** At the end of skip_log_binb section gtid list has 0 more:
flush logs;
show binlog events in 'master-bin.000007' limit 1,1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000007	#	Gtid_list	1	#	[0-1-25]
connection slave;
include/sync_with_master_gtid.inc
connection master;
drop database test_ign;
drop table t1, t2, t3, tm;
#
# MDEV-26682 slave lock timeout with XA and gap locks
#
create table t1 (a int primary key, b int unique) engine=innodb;
insert t1 values (1,1),(3,3),(5,5);
connection slave;
set session tx_isolation='repeatable-read';
start transaction;
select * from t1;
a	b
1	1
3	3
5	5
connect m2, localhost, root;
delete from t1 where a=3;
xa start 'x1';
update t1 set b=3 where a=5;
xa end 'x1';
xa prepare 'x1';
connect m3, localhost, root;
insert t1 values (2, 2);
-->slave
connection slave;
commit;
select * from t1;
a	b
1	1
2	2
5	5
connection m2;
xa rollback 'x1';
disconnect m2;
disconnect m3;
connection master;
drop table t1;
create table t1 (id int auto_increment primary key, c1 int not null unique)
engine=innodb;
create table t2 (id int auto_increment primary key, c1 int not null,
foreign key(c1) references t1(c1), unique key(c1)) engine=innodb;
insert t1 values (869,1), (871,3), (873,4), (872,5), (870,6), (877,7);
insert t2 values (795,6), (800,7);
xa start '1';
update t2 set id = 9, c1 = 5 where c1 in (null, null, null, null, null, 7, 3);
connect con1, localhost,root;
xa start '2';
delete from t1 where c1 like '3%';
xa end '2';
xa prepare '2';
connection master;
xa end '1';
xa prepare '1';
->slave
connection slave;
connection slave;
include/sync_with_master_gtid.inc
connection con1;
xa commit '2';
disconnect con1;
connection master;
xa commit '1';
drop table t2, t1;
include/rpl_end.inc