Debian Codegraph @

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

raw
1 #
2 # Purpose:
3 # If a fake Glle event follows a Gtid event, we need to ensure the rest of
4 # the group should not terminate at the Glle event. MDEV-28550 revealed that
5 # a Glle would terminate the event and upon reconnect, the DDL would be lost.
6 #
7 # Methodology:
8 # Force the primary to send a fake GLLE event after a GTID on a "reconnect"
9 # and ensure that both 1) the replica does not error, and 2) the original
10 # command within the GTID is executed.
11 #
12 # References:
13 # MDEV-28550: improper handling of replication event group that contains Gtid_log_list_event
14
15 --source include/master-slave.inc
16
17 # Independent of binlog format
18 --source include/have_binlog_format_statement.inc
19
20 --connection slave
21 --source include/stop_slave.inc
22 CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
23
24 --echo #
25 --echo # Initialize test data
26 --connection master
27 --source include/wait_for_binlog_checkpoint.inc
28 create table t1 (a int);
29 SET @@session.server_id= 3;
30 create table t2 (a int);
31 --source include/save_master_gtid.inc
32
33 --echo #
34 --echo # Have the replica "reconnect" and the primary will send Gtid, Glle, DDL
35 --connection slave
36 eval set global gtid_slave_pos="0-3-1";
37 --source include/start_slave.inc
38 --source include/sync_with_master_gtid.inc
39
40 --echo #
41 --echo # Ensure that the replica did not error
42 connection slave;
43 --source include/sync_with_master_gtid.inc
44 let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
45 --echo Last_SQL_Error = $error
46 let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
47 --echo Last_SQL_Errno = $errno
48
49 --echo #
50 --echo # Ensure that the primary sent a Glle after a Gtid event
51 let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
52 let $binlog_start= $relaylog_start;
53 let $binlog_limit=0,10;
54 --source include/show_relaylog_events.inc
55
56 --echo #
57 --echo # Ensure the DDL was executed on the replica
58 if (!`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't2'`)
59 {
60 die "t2 should exist on slave";
61 }
62
63 --echo #
64 --echo # Cleanup
65
66 --echo # t1 does not make it to the replica
67 --connection master
68 set sql_log_bin=0;
69 DROP TABLE t1;
70 set sql_log_bin=1;
71 DROP TABLE t2;
72
73 --source include/rpl_end.inc