Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # Test verifies that Start binlog_dump message will report GTID position
4 # requested by slave when log_warnings > 1.
5 #
6 # ==== Implementation ====
7 #
8 # Steps:
9 # 0 - Have LOG_WARNINGS=2
10 # 1 - On a fresh slave server which has not replicated any GTIDs execute
11 # "CHANGE MASTER TO MASTER_USE_GTID=slave_pos;" command. Start the
12 # slave.
13 # 2 - In Master error log verify that pattern "using_gtid(1), gtid('')" is
14 # present.
15 # 3 - On slave server do STOP SLAVE and execute "CHANGE MASTER TO
16 # MASTER_USE_GTID=no;" command. Start the slave threads.
17 # 4 - In Master error log verify that pattern "using_gtid(0), gtid('')" is
18 # present.
19 # 5- Execute a DDL and DML on master server. This will generated two GTIDs
20 # on the master server ('0-1-2'). Sync the slave server with master.
21 # 6 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
22 # MASTER_USE_GTID=slave_pos;" command. Start slave threads.
23 # 7 - In Master error verify that pattern "using_gtid(1), gtid('0-1-2')" is
24 # present.
25 # 8 - On Master change domain ID to 10 and execute a DML operation. It will
26 # generate a GTID 10-1-1.
27 # 9 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
28 # MASTER_USE_GTID=slave_pos;" command. Start slave threads.
29 # 10 -In Master error verify that pattern "using_gtid(1),
30 # gtid('0-1-2,10-1-1')" is present.
31 #
32 # ==== References ====
33 #
34 # MDEV-20428: "Start binlog_dump" message doesn't indicate GTID position
35 #
36
37 --source include/have_binlog_format_mixed.inc
38 --source include/have_innodb.inc
39 --source include/master-slave.inc
40
41 --connection master
42 SET @org_log_warnings=@@GLOBAL.LOG_WARNINGS;
43 SET GLOBAL LOG_WARNINGS=2;
44
45 --connection slave
46 --source include/stop_slave.inc
47 CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
48 --source include/start_slave.inc
49
50 --connection master
51 # Check error log for correct messages.
52 let $log_error_= `SELECT @@GLOBAL.log_error`;
53 if(!$log_error_)
54 {
55 # MySQL Server on windows is started with --console and thus
56 # does not know the location of its .err log, use default location
57 let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
58 }
59 --echo "Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
60 --let SEARCH_FILE=$log_error_
61 --let SEARCH_RANGE=-50000
62 --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
63 --let SEARCH_WAIT=FOUND
64 --source include/search_pattern_in_file.inc
65
66 --connection slave
67 --source include/stop_slave.inc
68 CHANGE MASTER TO MASTER_USE_GTID=no;
69 --source include/start_slave.inc
70
71 --connection master
72 --echo "Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
73 --let SEARCH_FILE=$log_error_
74 --let SEARCH_RANGE=-50000
75 --let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
76 --let SEARCH_WAIT=FOUND
77 --source include/search_pattern_in_file.inc
78 CREATE TABLE t (f INT) ENGINE=INNODB;
79 INSERT INTO t VALUES(10);
80 save_master_pos;
81
82 --connection slave
83 sync_with_master;
84
85 --connection slave
86 --source include/stop_slave.inc
87 CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
88 --source include/start_slave.inc
89
90 --connection master
91 --echo "Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
92 --let SEARCH_FILE=$log_error_
93 --let SEARCH_RANGE=-50000
94 --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
95 --let SEARCH_WAIT=FOUND
96 --source include/search_pattern_in_file.inc
97 SET @@SESSION.gtid_domain_id=10;
98 INSERT INTO t VALUES(20);
99 save_master_pos;
100
101 --connection slave
102 sync_with_master;
103
104 --connection slave
105 --source include/stop_slave.inc
106 CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
107 --source include/start_slave.inc
108
109 --connection master
110 --echo "Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
111 --let SEARCH_FILE=$log_error_
112 --let SEARCH_RANGE=-50000
113 --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
114 --let SEARCH_WAIT=FOUND
115 --source include/search_pattern_in_file.inc
116
117 --echo "===== Clean up ====="
118 SET GLOBAL LOG_WARNINGS=@org_log_warnings;
119 --connection slave
120 --source include/stop_slave.inc
121 CHANGE MASTER TO MASTER_USE_GTID=no;
122 --source include/start_slave.inc
123
124 --connection master
125 DROP TABLE t;
126 --source include/rpl_end.inc