Debian Codegraph @

mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result

raw
1 set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
2 include/master-slave.inc
3 [connection master]
4 connection master;
5 call mtr.add_suppression("Timeout waiting for reply of binlog");
6 call mtr.add_suppression("Read semi-sync reply");
7 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
8 call mtr.add_suppression("mysqld: Got an error reading communication packets");
9 connection slave;
10 set sql_log_bin=0;
11 call mtr.add_suppression("Semi-sync slave .* reply");
12 call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
13 set sql_log_bin=1;
14 connection master;
15 #
16 # Uninstall semi-sync plugins on master and slave
17 #
18 connection slave;
19 include/stop_slave.inc
20 include/reset_slave.inc
21 set global rpl_semi_sync_master_enabled= 0;
22 set global rpl_semi_sync_slave_enabled= 0;
23 connection master;
24 reset master;
25 set global rpl_semi_sync_master_enabled= 0;
26 set global rpl_semi_sync_slave_enabled= 0;
27 #
28 # Main test of semi-sync replication start here
29 #
30 connection master;
31 set global rpl_semi_sync_master_timeout= 2000;
32 [ default state of semi-sync on master should be OFF ]
33 show variables like 'rpl_semi_sync_master_enabled';
34 Variable_name Value
35 rpl_semi_sync_master_enabled OFF
36 [ enable semi-sync on master ]
37 set global rpl_semi_sync_master_enabled = 1;
38 show variables like 'rpl_semi_sync_master_enabled';
39 Variable_name Value
40 rpl_semi_sync_master_enabled ON
41 [ status of semi-sync on master should be ON even without any semi-sync slaves ]
42 show status like 'Rpl_semi_sync_master_clients';
43 Variable_name Value
44 Rpl_semi_sync_master_clients 0
45 show status like 'Rpl_semi_sync_master_status';
46 Variable_name Value
47 Rpl_semi_sync_master_status ON
48 show status like 'Rpl_semi_sync_master_yes_tx';
49 Variable_name Value
50 Rpl_semi_sync_master_yes_tx 0
51 #
52 # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed
53 # BUG#45673 Semisynch reports correct operation even if no slave is connected
54 #
55 [ status of semi-sync on master should be OFF ]
56 show status like 'Rpl_semi_sync_master_clients';
57 Variable_name Value
58 Rpl_semi_sync_master_clients 0
59 show status like 'Rpl_semi_sync_master_status';
60 Variable_name Value
61 Rpl_semi_sync_master_status OFF
62 show status like 'Rpl_semi_sync_master_yes_tx';
63 Variable_name Value
64 Rpl_semi_sync_master_yes_tx 0
65 reset master;
66 connection slave;
67 [ default state of semi-sync on slave should be OFF ]
68 show variables like 'rpl_semi_sync_slave_enabled';
69 Variable_name Value
70 rpl_semi_sync_slave_enabled OFF
71 [ enable semi-sync on slave ]
72 set global rpl_semi_sync_slave_enabled = 1;
73 show variables like 'rpl_semi_sync_slave_enabled';
74 Variable_name Value
75 rpl_semi_sync_slave_enabled ON
76 include/start_slave.inc
77 connection master;
78 [ initial master state after the semi-sync slave connected ]
79 show status like 'Rpl_semi_sync_master_clients';
80 Variable_name Value
81 Rpl_semi_sync_master_clients 1
82 show status like 'Rpl_semi_sync_master_status';
83 Variable_name Value
84 Rpl_semi_sync_master_status ON
85 show status like 'Rpl_semi_sync_master_no_tx';
86 Variable_name Value
87 Rpl_semi_sync_master_no_tx 0
88 show status like 'Rpl_semi_sync_master_yes_tx';
89 Variable_name Value
90 Rpl_semi_sync_master_yes_tx 0
91 create table t1(a int) engine = ENGINE_TYPE;
92 [ master state after CREATE TABLE statement ]
93 show status like 'Rpl_semi_sync_master_status';
94 Variable_name Value
95 Rpl_semi_sync_master_status ON
96 show status like 'Rpl_semi_sync_master_no_tx';
97 Variable_name Value
98 Rpl_semi_sync_master_no_tx 0
99 show status like 'Rpl_semi_sync_master_yes_tx';
100 Variable_name Value
101 Rpl_semi_sync_master_yes_tx 1
102 select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0';
103 Should be 0
104 0
105 [ insert records to table ]
106 insert t1 values (10);
107 insert t1 values (9);
108 insert t1 values (8);
109 insert t1 values (7);
110 insert t1 values (6);
111 insert t1 values (5);
112 insert t1 values (4);
113 insert t1 values (3);
114 insert t1 values (2);
115 insert t1 values (1);
116 [ master status after inserts ]
117 show status like 'Rpl_semi_sync_master_status';
118 Variable_name Value
119 Rpl_semi_sync_master_status ON
120 show status like 'Rpl_semi_sync_master_no_tx';
121 Variable_name Value
122 Rpl_semi_sync_master_no_tx 0
123 show status like 'Rpl_semi_sync_master_yes_tx';
124 Variable_name Value
125 Rpl_semi_sync_master_yes_tx 11
126 connection slave;
127 [ slave status after replicated inserts ]
128 show status like 'Rpl_semi_sync_slave_status';
129 Variable_name Value
130 Rpl_semi_sync_slave_status ON
131 select count(distinct a) from t1;
132 count(distinct a)
133 10
134 select min(a) from t1;
135 min(a)
136 1
137 select max(a) from t1;
138 max(a)
139 10
140
141 # BUG#50157
142 # semi-sync replication crashes when replicating a transaction which
143 # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ;
144 connection master;
145 SET SESSION AUTOCOMMIT= 0;
146 CREATE TABLE t2(c1 INT) ENGINE=innodb;
147 connection slave;
148 connection master;
149 BEGIN;
150
151 # Even though it is in a transaction, this statement is binlogged into binlog
152 # file immediately.
153 CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1;
154
155 # These statements will not be binlogged until the transaction is committed
156 INSERT INTO t2 VALUES(11);
157 INSERT INTO t2 VALUES(22);
158 COMMIT;
159 DROP TABLE t2, t3;
160 SET SESSION AUTOCOMMIT= 1;
161 connection slave;
162 #
163 # Test semi-sync master will switch OFF after one transaction
164 # timeout waiting for slave reply.
165 #
166 connection master;
167 show status like "Rpl_semi_sync_master_status";
168 Variable_name Value
169 Rpl_semi_sync_master_status ON
170 connection slave;
171 include/stop_slave.inc
172 connection master;
173 include/kill_binlog_dump_threads.inc
174 set global rpl_semi_sync_master_timeout= 2000;
175 [ master status should be ON ]
176 show status like 'Rpl_semi_sync_master_no_tx';
177 Variable_name Value
178 Rpl_semi_sync_master_no_tx 0
179 show status like 'Rpl_semi_sync_master_yes_tx';
180 Variable_name Value
181 Rpl_semi_sync_master_yes_tx 16
182 [ semi-sync replication of these transactions will fail ]
183 insert into t1 values (500);
184 [ master status should be OFF ]
185 show status like 'Rpl_semi_sync_master_status';
186 Variable_name Value
187 Rpl_semi_sync_master_status OFF
188 show status like 'Rpl_semi_sync_master_no_tx';
189 Variable_name Value
190 Rpl_semi_sync_master_no_tx 1
191 show status like 'Rpl_semi_sync_master_yes_tx';
192 Variable_name Value
193 Rpl_semi_sync_master_yes_tx 16
194 delete from t1 where a=10;
195 delete from t1 where a=9;
196 delete from t1 where a=8;
197 delete from t1 where a=7;
198 delete from t1 where a=6;
199 delete from t1 where a=5;
200 delete from t1 where a=4;
201 delete from t1 where a=3;
202 delete from t1 where a=2;
203 delete from t1 where a=1;
204 insert into t1 values (100);
205 [ master status should be OFF ]
206 show status like 'Rpl_semi_sync_master_status';
207 Variable_name Value
208 Rpl_semi_sync_master_status OFF
209 show status like 'Rpl_semi_sync_master_no_tx';
210 Variable_name Value
211 Rpl_semi_sync_master_no_tx 12
212 show status like 'Rpl_semi_sync_master_yes_tx';
213 Variable_name Value
214 Rpl_semi_sync_master_yes_tx 16
215 #
216 # Test semi-sync status on master will be ON again when slave catches up
217 #
218 connection slave;
219 [ slave status should be OFF ]
220 show status like 'Rpl_semi_sync_slave_status';
221 Variable_name Value
222 Rpl_semi_sync_slave_status OFF
223 include/start_slave.inc
224 [ slave status should be ON ]
225 show status like 'Rpl_semi_sync_slave_status';
226 Variable_name Value
227 Rpl_semi_sync_slave_status ON
228 select count(distinct a) from t1;
229 count(distinct a)
230 2
231 select min(a) from t1;
232 min(a)
233 100
234 select max(a) from t1;
235 max(a)
236 500
237 connection master;
238 [ master status should be ON again after slave catches up ]
239 show status like 'Rpl_semi_sync_master_no_tx';
240 Variable_name Value
241 Rpl_semi_sync_master_no_tx 12
242 show status like 'Rpl_semi_sync_master_yes_tx';
243 Variable_name Value
244 Rpl_semi_sync_master_yes_tx 16
245 show status like 'Rpl_semi_sync_master_clients';
246 Variable_name Value
247 Rpl_semi_sync_master_clients 1
248 #
249 # Test disable/enable master semi-sync on the fly.
250 #
251 drop table t1;
252 connection slave;
253 include/stop_slave.inc
254 #
255 # Flush status
256 #
257 connection master;
258 [ Semi-sync master status variables before FLUSH STATUS ]
259 SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
260 Variable_name Value
261 Rpl_semi_sync_master_no_tx 12
262 SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
263 Variable_name Value
264 Rpl_semi_sync_master_yes_tx 17
265 FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
266 [ Semi-sync master status variables after FLUSH STATUS ]
267 SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
268 Variable_name Value
269 Rpl_semi_sync_master_no_tx 0
270 SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
271 Variable_name Value
272 Rpl_semi_sync_master_yes_tx 0
273 connection master;
274 show master logs;
275 Log_name master-bin.000001
276 File_size #
277 show variables like 'rpl_semi_sync_master_enabled';
278 Variable_name Value
279 rpl_semi_sync_master_enabled ON
280 [ disable semi-sync on the fly ]
281 set global rpl_semi_sync_master_enabled=0;
282 show variables like 'rpl_semi_sync_master_enabled';
283 Variable_name Value
284 rpl_semi_sync_master_enabled OFF
285 show status like 'Rpl_semi_sync_master_status';
286 Variable_name Value
287 Rpl_semi_sync_master_status OFF
288 [ enable semi-sync on the fly ]
289 set global rpl_semi_sync_master_enabled=1;
290 show variables like 'rpl_semi_sync_master_enabled';
291 Variable_name Value
292 rpl_semi_sync_master_enabled ON
293 show status like 'Rpl_semi_sync_master_status';
294 Variable_name Value
295 Rpl_semi_sync_master_status ON
296 #
297 # Test RESET MASTER/SLAVE
298 #
299 connection slave;
300 include/start_slave.inc
301 connection master;
302 create table t1 (a int) engine = ENGINE_TYPE;
303 drop table t1;
304 connection slave;
305 [ test reset master ]
306 connection master;
307 reset master;
308 show status like 'Rpl_semi_sync_master_status';
309 Variable_name Value
310 Rpl_semi_sync_master_status ON
311 show status like 'Rpl_semi_sync_master_no_tx';
312 Variable_name Value
313 Rpl_semi_sync_master_no_tx 0
314 show status like 'Rpl_semi_sync_master_yes_tx';
315 Variable_name Value
316 Rpl_semi_sync_master_yes_tx 0
317 connection slave;
318 include/stop_slave.inc
319 include/reset_slave.inc
320 include/kill_binlog_dump_threads.inc
321 connection slave;
322 include/start_slave.inc
323 connection master;
324 connection slave;
325 connection master;
326 create table t1 (a int) engine = ENGINE_TYPE;
327 insert into t1 values (1);
328 insert into t1 values (2), (3);
329 connection slave;
330 select * from t1;
331 a
332 1
333 2
334 3
335 connection master;
336 [ master semi-sync status should be ON ]
337 show status like 'Rpl_semi_sync_master_status';
338 Variable_name Value
339 Rpl_semi_sync_master_status ON
340 show status like 'Rpl_semi_sync_master_no_tx';
341 Variable_name Value
342 Rpl_semi_sync_master_no_tx 0
343 show status like 'Rpl_semi_sync_master_yes_tx';
344 Variable_name Value
345 Rpl_semi_sync_master_yes_tx 3
346 #
347 # Start semi-sync replication without SUPER privilege
348 #
349 connection slave;
350 include/stop_slave.inc
351 include/reset_slave.inc
352 connection master;
353 reset master;
354 include/kill_binlog_dump_threads.inc
355 set sql_log_bin=0;
356 grant replication slave on *.* to [email protected] identified by 'rpl_password';
357 flush privileges;
358 set sql_log_bin=1;
359 connection slave;
360 grant replication slave on *.* to [email protected] identified by 'rpl_password';
361 flush privileges;
362 change master to master_user='rpl',master_password='rpl_password';
363 include/start_slave.inc
364 show status like 'Rpl_semi_sync_slave_status';
365 Variable_name Value
366 Rpl_semi_sync_slave_status ON
367 connection master;
368 connection slave;
369 connection master;
370 [ master semi-sync should be ON ]
371 show status like 'Rpl_semi_sync_master_clients';
372 Variable_name Value
373 Rpl_semi_sync_master_clients 1
374 show status like 'Rpl_semi_sync_master_status';
375 Variable_name Value
376 Rpl_semi_sync_master_status ON
377 show status like 'Rpl_semi_sync_master_no_tx';
378 Variable_name Value
379 Rpl_semi_sync_master_no_tx 0
380 show status like 'Rpl_semi_sync_master_yes_tx';
381 Variable_name Value
382 Rpl_semi_sync_master_yes_tx 0
383 insert into t1 values (4);
384 insert into t1 values (5);
385 [ master semi-sync should be ON ]
386 show status like 'Rpl_semi_sync_master_clients';
387 Variable_name Value
388 Rpl_semi_sync_master_clients 1
389 show status like 'Rpl_semi_sync_master_status';
390 Variable_name Value
391 Rpl_semi_sync_master_status ON
392 show status like 'Rpl_semi_sync_master_no_tx';
393 Variable_name Value
394 Rpl_semi_sync_master_no_tx 0
395 show status like 'Rpl_semi_sync_master_yes_tx';
396 Variable_name Value
397 Rpl_semi_sync_master_yes_tx 2
398 #
399 # Test semi-sync slave connect to non-semi-sync master
400 #
401 connection slave;
402 include/stop_slave.inc
403 SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
404 Variable_name Value
405 Rpl_semi_sync_slave_status OFF
406 connection master;
407 include/kill_binlog_dump_threads.inc
408 [ Semi-sync status on master should be ON ]
409 show status like 'Rpl_semi_sync_master_status';
410 Variable_name Value
411 Rpl_semi_sync_master_status ON
412 set global rpl_semi_sync_master_enabled= 0;
413 connection slave;
414 SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
415 Variable_name Value
416 rpl_semi_sync_slave_enabled ON
417 include/start_slave.inc
418 connection master;
419 insert into t1 values (8);
420 [ master semi-sync clients should be 1, status should be OFF ]
421 show status like 'Rpl_semi_sync_master_clients';
422 Variable_name Value
423 Rpl_semi_sync_master_clients 1
424 show status like 'Rpl_semi_sync_master_status';
425 Variable_name Value
426 Rpl_semi_sync_master_status OFF
427 connection slave;
428 show status like 'Rpl_semi_sync_slave_status';
429 Variable_name Value
430 Rpl_semi_sync_slave_status ON
431 connection slave;
432 include/stop_slave.inc
433 connection master;
434 set global rpl_semi_sync_master_enabled= 0;
435 connection slave;
436 SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
437 Variable_name Value
438 rpl_semi_sync_slave_enabled ON
439 include/start_slave.inc
440 connection master;
441 insert into t1 values (10);
442 connection slave;
443 #
444 # Test non-semi-sync slave connect to semi-sync master
445 #
446 connection master;
447 set global rpl_semi_sync_master_timeout= 5000;
448 set global rpl_semi_sync_master_enabled= 1;
449 connection slave;
450 include/stop_slave.inc
451 SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
452 Variable_name Value
453 Rpl_semi_sync_slave_status OFF
454 [ uninstall semi-sync slave plugin ]
455 set global rpl_semi_sync_slave_enabled= 0;
456 [ reinstall semi-sync slave plugin and disable semi-sync ]
457 SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
458 Variable_name Value
459 rpl_semi_sync_slave_enabled OFF
460 SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
461 Variable_name Value
462 Rpl_semi_sync_slave_status OFF
463 include/start_slave.inc
464 SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
465 Variable_name Value
466 Rpl_semi_sync_slave_status OFF
467 #
468 # Clean up
469 #
470 connection slave;
471 include/stop_slave.inc
472 set global rpl_semi_sync_slave_enabled= 0;
473 connection master;
474 set global rpl_semi_sync_master_enabled= 0;
475 connection slave;
476 change master to master_user='root',master_password='';
477 include/start_slave.inc
478 connection master;
479 drop table t1;
480 connection slave;
481 connection master;
482 drop user [email protected];
483 flush privileges;
484 set global rpl_semi_sync_master_timeout= default;
485 include/rpl_end.inc
486 set global rpl_semi_sync_master_wait_point=default;