Debian Codegraph @

mysql-test/suite/rpl/t/rpl_gtid_crash.test

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 # Valgrind does not work well with test that crashes the server
4 --source include/not_valgrind.inc
5
6 --let $rpl_topology=1->2
7 --source include/rpl_init.inc
8
9 --echo *** Test crashing master, causing slave IO thread to reconnect while SQL thread is running ***
10
11 --connection server_1
12 call mtr.add_suppression("Checking table:");
13 call mtr.add_suppression("client is using or hasn't closed the table properly");
14 call mtr.add_suppression("Table .* is marked as crashed and should be repaired");
15 call mtr.add_suppression("Could not read packet:.* errno: 11");
16 flush tables;
17
18 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
19 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
20 INSERT INTO t1 VALUES (1, 0);
21 --save_master_pos
22
23 --connection server_2
24 --sync_with_master
25 SET sql_log_bin=0;
26 call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
27 call mtr.add_suppression('Slave I/O: .*Lost connection to server during query');
28 call mtr.add_suppression("Slave I/O thread couldn't register on master");
29 SET sql_log_bin=1;
30 --source include/stop_slave.inc
31 --replace_result $MASTER_MYPORT MASTER_PORT
32 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
33 MASTER_USE_GTID=SLAVE_POS;
34
35 --connection server_1
36 INSERT INTO t1 VALUES (2,1);
37 INSERT INTO t1 VALUES (3,1);
38
39 --connection server_2
40 --source include/start_slave.inc
41
42 --connection server_1
43
44 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
45 wait-rpl_gtid_crash.test
46 EOF
47
48 let $1=200;
49 --disable_query_log
50 while ($1)
51 {
52 eval INSERT INTO t1 VALUES ($1 + 10, 2);
53 dec $1;
54 }
55 --enable_query_log
56 --source include/save_master_gtid.inc
57
58 SET SESSION debug_dbug="+d,crash_dispatch_command_before";
59 --error 2006,2013
60 SELECT 1;
61 --source include/wait_until_disconnected.inc
62
63 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
64 restart-rpl_gtid_crash.test
65 EOF
66
67 --enable_reconnect
68 --source include/wait_until_connected_again.inc
69
70 --connection server_2
71 --source include/sync_with_master_gtid.inc
72
73 --connection server_1
74 INSERT INTO t1 VALUES (1000, 3);
75 --source include/save_master_gtid.inc
76
77 --connection server_2
78 --source include/sync_with_master_gtid.inc
79
80 --connection server_1
81 DROP TABLE t1;
82 --save_master_pos
83
84 --echo *** Test crashing the master mysqld and check that binlog state is recovered. ***
85 --connection server_2
86 --sync_with_master
87 --source include/stop_slave.inc
88 RESET MASTER;
89 SET GLOBAL gtid_slave_pos='';
90
91 --connection server_1
92 RESET MASTER;
93 --replace_column 2 # 4 # 5 #
94 SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 1,1;
95 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
96
97 --connection server_2
98 --source include/start_slave.inc
99
100 --connection server_1
101 SET gtid_domain_id= 1;
102 INSERT INTO t1 VALUES (1);
103 INSERT INTO t1 VALUES (2);
104 FLUSH LOGS;
105 SET gtid_domain_id= 2;
106 INSERT INTO t1 VALUES (3);
107 FLUSH LOGS;
108 --source include/show_binary_logs.inc
109 --replace_column 2 # 4 # 5 # 6 #
110 SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
111
112 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
113 wait
114 EOF
115
116 SET SESSION debug_dbug="+d,crash_dispatch_command_before";
117 --error 2006,2013
118 SELECT 1;
119 --source include/wait_until_disconnected.inc
120
121 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
122 restart
123 EOF
124
125 --enable_reconnect
126 --source include/wait_until_connected_again.inc
127
128 --source include/show_binary_logs.inc
129 --replace_column 2 # 4 # 5 # 6 #
130 SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
131 --save_master_pos
132
133 --connection server_2
134 --sync_with_master
135 SELECT * FROM t1 ORDER BY a;
136
137
138 --echo *** Test crashing slave at various points and check that it recovers crash-safe. ***
139
140 # Crash the slave just before updating mysql.gtid_slave_pos table.
141 --source include/stop_slave.inc
142 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
143 wait
144 EOF
145 # We do not have to save @@GLOBAL.debug_dbug, it is reset when slave crashes.
146 SET GLOBAL debug_dbug="+d,inject_crash_before_write_rpl_slave_state";
147 START SLAVE;
148
149 --connection server_1
150 INSERT INTO t1 VALUES (4);
151 --source include/save_master_gtid.inc
152
153 --connection server_2
154 --source include/wait_until_disconnected.inc
155
156 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
157 restart: --skip-slave-start=0
158 EOF
159
160 --enable_reconnect
161 --source include/wait_until_connected_again.inc
162
163 --source include/sync_with_master_gtid.inc
164
165 # Crash the slave just before committing.
166 --source include/stop_slave.inc
167 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
168 wait
169 EOF
170 START SLAVE;
171 --error 0,2006,2013
172 SET GLOBAL debug_dbug="+d,crash_commit_before";
173
174 --connection server_1
175 INSERT INTO t1 VALUES (5);
176 --source include/save_master_gtid.inc
177
178 --connection server_2
179 --source include/wait_until_disconnected.inc
180
181 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
182 restart: --skip-slave-start=0
183 EOF
184
185 --enable_reconnect
186 --source include/wait_until_connected_again.inc
187
188 --source include/sync_with_master_gtid.inc
189
190 # Crash the slave just after committing.
191 --source include/stop_slave.inc
192 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
193 wait
194 EOF
195 START SLAVE;
196 --error 0,2006,2013
197 SET GLOBAL debug_dbug="+d,crash_commit_after";
198
199 --connection server_1
200 INSERT INTO t1 VALUES (6);
201 --source include/save_master_gtid.inc
202
203 --connection server_2
204 --source include/wait_until_disconnected.inc
205
206 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
207 restart: --skip-slave-start=0
208 EOF
209
210 --enable_reconnect
211 --source include/wait_until_connected_again.inc
212
213 --source include/sync_with_master_gtid.inc
214
215 # Crash the slave just before updating relay-log.info
216 --source include/stop_slave.inc
217 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
218 wait
219 EOF
220 SET GLOBAL debug_dbug="+d,inject_crash_before_flush_rli";
221 --error 0,2006,2013
222 START SLAVE;
223
224 --connection server_1
225 INSERT INTO t1 VALUES (7);
226 --source include/save_master_gtid.inc
227
228 --connection server_2
229 --source include/wait_until_disconnected.inc
230
231 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
232 restart: --skip-slave-start=0
233 EOF
234
235 --enable_reconnect
236 --source include/wait_until_connected_again.inc
237
238 --source include/sync_with_master_gtid.inc
239
240 # Crash the slave just after updating relay-log.info
241 --source include/stop_slave.inc
242 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
243 wait
244 EOF
245 SET GLOBAL debug_dbug="+d,inject_crash_after_flush_rli";
246 --error 0,2006,2013
247 START SLAVE;
248
249 --connection server_1
250 INSERT INTO t1 VALUES (8);
251 --source include/save_master_gtid.inc
252
253 --connection server_2
254 --source include/wait_until_disconnected.inc
255
256 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
257 restart: --skip-slave-start=0
258 EOF
259
260 --enable_reconnect
261 --source include/wait_until_connected_again.inc
262
263 --source include/sync_with_master_gtid.inc
264
265
266 # Check that everything was replicated correctly.
267 SELECT * FROM t1 ORDER BY a;
268
269
270 --echo *** MDEV-4725: Incorrect recovery when crash in the middle of writing an event group ***
271
272 --connection server_2
273 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
274 wait
275 EOF
276
277 --let $old_gtid_strict= `SELECT @@gtid_strict_mode`
278 SET GLOBAL debug_dbug="+d,crash_before_writing_xid";
279
280 --connection server_1
281 INSERT INTO t1 VALUES (9), (10);
282 --let $saved_gtid=`SELECT @@last_gtid`
283 --save_master_pos
284
285 --connection server_2
286 --source include/wait_until_disconnected.inc
287
288 # The bug was that during crash recovery we would update the binlog state
289 # with the GTID of the half-written event group at the end of the slaves
290 # binlog, even though this event group was not committed.
291 # We restart the server with gtid_strict_mode; this way, we get an error
292 # about duplicate gtid when the slave re-executes the event group, if the
293 # binlog crash recovery is incorrect.
294 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
295 restart: --gtid_strict_mode=1
296 EOF
297
298 --enable_reconnect
299 --source include/wait_until_connected_again.inc
300
301 SHOW VARIABLES like 'gtid_strict_mode';
302 --source include/start_slave.inc
303 --sync_with_master
304 --disable_query_log
305 eval SET GLOBAL gtid_strict_mode= $old_gtid_strict;
306 --enable_query_log
307
308
309 --echo *** MDEV-6462: Incorrect recovery on a slave reconnecting to crashed master ***
310
311 --connection server_1
312 set sql_log_bin= 0;
313 call mtr.add_suppression("Error writing file 'master-bin'");
314 set sql_log_bin= 1;
315 --connection server_2
316 set sql_log_bin= 0;
317 call mtr.add_suppression("The server_id of master server changed in the middle of GTID");
318 call mtr.add_suppression("Unexpected change of master binlog file name in the middle of GTID");
319 set sql_log_bin= 1;
320
321 --connection server_1
322 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
323 wait
324 EOF
325
326 SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
327 BEGIN;
328 INSERT INTO t1 VALUES (11);
329 --error ER_ERROR_ON_WRITE
330 COMMIT;
331 SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
332 --error 2006,2013
333 COMMIT;
334
335 --source include/wait_until_disconnected.inc
336
337 # Simulate that we reconnect to a different server (new server_id).
338 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
339 restart: --server-id=3
340 EOF
341
342 --enable_reconnect
343 --source include/wait_until_connected_again.inc
344
345 SELECT @@GLOBAL.server_id;
346 SELECT * from t1 WHERE a > 10 ORDER BY a;
347 --disable_query_log
348 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
349 --enable_query_log
350
351 --echo # Wait 60 seconds for SQL thread to catch up with IO thread
352 --connection server_2
353 --let $wait_timeout= 600
354 while ($wait_timeout != 0)
355 {
356 --let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
357 --let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
358 if ($read_log_pos == $exec_log_pos)
359 {
360 --let $wait_timeout= 0
361 }
362 if ($read_log_pos != $exec_log_pos)
363 {
364 --sleep 0.1
365 --dec $wait_timeout
366 }
367 }
368 if ($read_log_pos != $exec_log_pos)
369 {
370 --die Timeout wait for SQL thread to catch up with IO thread
371 }
372
373 SELECT * from t1 WHERE a > 10 ORDER BY a;
374 --disable_query_log
375 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
376 eval SELECT IF(INSTR(@@gtid_slave_pos, '$saved_gtid'), "Slave pos ok", CONCAT("Unexpected slave pos: ", @@gtid_slave_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
377 eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
378 --enable_query_log
379
380 --echo # Repeat this with additional transactions on the master
381
382 --connection server_1
383 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
384 wait
385 EOF
386
387 SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
388 BEGIN;
389 INSERT INTO t1 VALUES (12);
390 --error ER_ERROR_ON_WRITE
391 COMMIT;
392 SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
393 --error 2006,2013
394 COMMIT;
395
396 --source include/wait_until_disconnected.inc
397
398 # Simulate that we reconnect to a different server (new server_id).
399 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
400 restart: --server-id=1
401 EOF
402
403 --enable_reconnect
404 --source include/wait_until_connected_again.inc
405
406 SELECT @@GLOBAL.server_id;
407 INSERT INTO t1 VALUES (13);
408 INSERT INTO t1 VALUES (14);
409 --let $saved_gtid=`SELECT @@last_gtid`
410 SELECT * from t1 WHERE a > 10 ORDER BY a;
411 --source include/save_master_gtid.inc
412
413 --connection server_2
414 --source include/sync_with_master_gtid.inc
415 SELECT * from t1 WHERE a > 10 ORDER BY a;
416
417 --connection server_1
418 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
419 wait
420 EOF
421
422 SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
423 BEGIN;
424 INSERT INTO t1 VALUES (21);
425 --error ER_ERROR_ON_WRITE
426 COMMIT;
427 SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
428 --error 2006,2013
429 COMMIT;
430
431 --source include/wait_until_disconnected.inc
432
433 # Simulate that we reconnect to the same server (same server_id).
434 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
435 restart
436 EOF
437
438 --enable_reconnect
439 --source include/wait_until_connected_again.inc
440
441 SELECT @@GLOBAL.server_id;
442 SELECT * from t1 WHERE a > 10 ORDER BY a;
443 --disable_query_log
444 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
445 eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
446 --enable_query_log
447
448 --echo # Wait 60 seconds for SQL thread to catch up with IO thread
449 --connection server_2
450 --let $wait_timeout= 600
451 while ($wait_timeout != 0)
452 {
453 --let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
454 --let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
455 if ($read_log_pos == $exec_log_pos)
456 {
457 --let $wait_timeout= 0
458 }
459 if ($read_log_pos != $exec_log_pos)
460 {
461 --sleep 0.1
462 --dec $wait_timeout
463 }
464 }
465 if ($read_log_pos != $exec_log_pos)
466 {
467 --die Timeout wait for SQL thread to catch up with IO thread
468 }
469
470 SELECT * from t1 WHERE a > 10 ORDER BY a;
471 --disable_query_log
472 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
473 eval SELECT IF(INSTR(@@gtid_slave_pos, '$saved_gtid'), "Slave pos ok", CONCAT("Unexpected slave pos: ", @@gtid_slave_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
474 eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
475 --enable_query_log
476
477 --echo # Repeat this with additional transactions on the master
478
479 --connection server_1
480 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
481 wait
482 EOF
483
484 SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
485 BEGIN;
486 INSERT INTO t1 VALUES (22);
487 --error ER_ERROR_ON_WRITE
488 COMMIT;
489 SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
490 --error 2006,2013
491 COMMIT;
492
493 --source include/wait_until_disconnected.inc
494
495 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
496 restart
497 EOF
498
499 --enable_reconnect
500 --source include/wait_until_connected_again.inc
501
502 INSERT INTO t1 VALUES (23);
503 INSERT INTO t1 VALUES (24);
504 --let $saved_gtid=`SELECT @@last_gtid`
505 SELECT * from t1 WHERE a > 10 ORDER BY a;
506 --source include/save_master_gtid.inc
507
508 --connection server_2
509 --source include/sync_with_master_gtid.inc
510 SELECT * from t1 WHERE a > 10 ORDER BY a;
511
512 --echo # Repeat this with slave restart
513
514 --connection server_1
515 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
516 wait
517 EOF
518
519 SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
520 BEGIN;
521 INSERT INTO t1 VALUES (25);
522 --error ER_ERROR_ON_WRITE
523 COMMIT;
524 SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
525 --error 2006,2013
526 COMMIT;
527
528 --source include/wait_until_disconnected.inc
529
530 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
531 restart
532 EOF
533
534 --connection server_1
535 --enable_reconnect
536 --source include/wait_until_connected_again.inc
537
538 --connection server_2
539 --echo # Wait 60 seconds for IO thread to connect and SQL thread to catch up
540 --echo # with IO thread.
541 --let $wait_timeout= 600
542 while ($wait_timeout != 0)
543 {
544 --let $connected=`SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State = 'Waiting for master to send event'`
545 if ($connected)
546 {
547 --let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
548 --let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
549 if ($read_log_pos == $exec_log_pos)
550 {
551 --let $wait_timeout= 0
552 }
553 if ($read_log_pos != $exec_log_pos)
554 {
555 --sleep 0.1
556 --dec $wait_timeout
557 }
558 }
559 if (!$connected)
560 {
561 --sleep 0.1
562 --dec $wait_timeout
563 }
564 }
565 if (`SELECT NOT $connected OR $read_log_pos != $exec_log_pos`)
566 {
567 --die Timeout wait for IO thread to connect and SQL thread to catch up with IO thread
568 }
569
570 --source include/stop_slave.inc
571
572 --connection server_1
573 --disable_query_log
574 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
575 eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
576 --enable_query_log
577 INSERT INTO t1 VALUES (26);
578 INSERT INTO t1 VALUES (27);
579 SELECT * from t1 WHERE a > 10 ORDER BY a;
580 --source include/save_master_gtid.inc
581
582 --connection server_2
583 --disable_query_log
584 eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
585 eval SELECT IF(INSTR(@@gtid_slave_pos, '$saved_gtid'), "Slave pos ok", CONCAT("Unexpected slave pos: ", @@gtid_slave_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
586 eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
587 --enable_query_log
588 --source include/start_slave.inc
589 --source include/sync_with_master_gtid.inc
590 SELECT * from t1 WHERE a > 10 ORDER BY a;
591
592
593 --echo *** MDEV-6391: GTID binlog state not recovered if mariadb-bin.state is removed ***
594
595 --connection server_2
596 --source include/stop_slave.inc
597
598 # Do some misc. transactions, stop the master, drop the master-bin.state file.
599 # Start the master back up, check that binlog state is correct.
600
601 --connection server_1
602
603 INSERT INTO t1 VALUES (30);
604 SET @old_server_id= @@server_id;
605 SET @old_domain_id= @@gtid_domain_id;
606
607 SET SESSION server_id= 10;
608 INSERT INTO t1 VALUES (31);
609 INSERT INTO t1 VALUES (32);
610 SET SESSION gtid_domain_id= 1;
611 SET SESSION server_id=11;
612 INSERT INTO t1 VALUES (33);
613 SET SESSION gtid_domain_id= 2;
614 INSERT INTO t1 VALUES (34);
615 SET SESSION server_id= 10;
616 INSERT INTO t1 VALUES (35);
617 INSERT INTO t1 VALUES (36);
618 SET SESSION gtid_domain_id= 0;
619 SET SESSION server_id= 12;
620 INSERT INTO t1 VALUES (37);
621 SET SESSION gtid_domain_id= @old_domain_id;
622 SET SESSION server_id= @old_server_id;
623 INSERT INTO t1 VALUES (38);
624 INSERT INTO t1 VALUES (39);
625 SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
626 --source include/save_master_gtid.inc
627
628 --let OLD_STATE= `SELECT @@gtid_binlog_state`
629
630 --let $datadir= `SELECT @@datadir`
631
632 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
633 wait
634 EOF
635 shutdown_server;
636 --source include/wait_until_disconnected.inc
637
638 --remove_file $datadir/master-bin.state
639
640 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
641 restart
642 EOF
643 --enable_reconnect
644 --source include/wait_until_connected_again.inc
645
646 --let NEW_STATE= `SELECT @@gtid_binlog_state`
647
648 --perl
649 my $old= $ENV{'OLD_STATE'};
650 my $new= $ENV{'NEW_STATE'};
651 # Make them order-independent, for easy comparison.
652 $old= join(",", sort(split(",", $old)));
653 $new= join(",", sort(split(",", $new)));
654 die "ERROR: new binlog state '$new' differs from old '$old'\n"
655 unless $old eq $new;
656 EOF
657
658 --connection server_2
659 --source include/start_slave.inc
660 --source include/sync_with_master_gtid.inc
661 SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
662
663
664 --connection server_1
665 DROP TABLE t1;
666
667 --connection default
668 --enable_reconnect
669 --source include/wait_until_connected_again.inc
670
671 --source include/rpl_end.inc