Debian Codegraph @

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

raw
1 source include/master-slave.inc;
2
3 connection slave;
4 source include/stop_slave.inc;
5 CHANGE MASTER TO MASTER_USE_GTID=NO;
6 source include/start_slave.inc;
7 connection master;
8
9 #
10 # BUG#28421 Infinite loop on slave relay logs
11 #
12 # That, manually deleteing one or more entries from 'master-bin.index', will
13 # cause master infinitely loop to send one binlog file.
14 #
15 # Manually changing index file is a illegal action, so when this happen, we
16 # send a fatal error to slave and close the dump session.
17
18 FLUSH LOGS;
19 # Now, 2 entries in index file.
20 # ./master-bin.000001
21 # ./master-bin.000002
22
23 CREATE TABLE t1(c1 INT);
24 # Now, the current dump file(master-bin.000002) is the second line of index
25 # file
26 sync_slave_with_master;
27 # Now, all events has been replicate to slave. As current dump file
28 # (master-bin.000002) is the last binlog file, so master is waiting for new
29 # events.
30
31 connection master;
32 # Delete './master-bin.000001' from index file.
33 let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
34 let TRUNCATE_FILE= $MYSQLD_DATADIR/master-bin.index;
35 source include/truncate_file.inc;
36
37 if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
38 {
39 append_file $MYSQLD_DATADIR/master-bin.index;
40 ./master-bin.000002
41 EOF
42 sleep 0.00000001;
43 }
44
45 if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
46 {
47 append_file $MYSQLD_DATADIR/master-bin.index;
48 .\master-bin.000002
49 EOF
50 sleep 0.00000001;
51 }
52
53 # Now, only 1 entry in index file. ./master-bin.000002
54
55 # Generate master-bin.000003, but it is in the second line.
56 FLUSH LOGS;
57 # Now, 2 entries in index file.
58 # ./master-bin.000002
59 # ./master-bin.000003
60
61 # Now, master know that new binlog file(master-bin.000003) has been generated.
62 # It expects that the new binlog file is in third line of index file, but
63 # there is no third line in index file. It is so strange that master sends an
64 # error to slave.
65 call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
66 connection slave;
67 # 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
68 --let $slave_io_errno= 1236
69 --let $show_slave_io_error= 1
70 # Mask line numbers
71 --let $slave_io_error_replace= / at [0-9]*/ at XXX/ /the first event '(\.|master-bin.000001)'/the first event 'FILE'/
72 --source include/wait_for_slave_io_error.inc
73
74 connection master;
75
76 source include/truncate_file.inc;
77
78 if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
79 {
80 append_file $MYSQLD_DATADIR/master-bin.index;
81 ./master-bin.000001
82 ./master-bin.000002
83 ./master-bin.000003
84 EOF
85 sleep 0.00000001;
86 }
87
88 if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
89 {
90 append_file $MYSQLD_DATADIR/master-bin.index;
91 .\master-bin.000001
92 .\master-bin.000002
93 .\master-bin.000003
94 EOF
95 sleep 0.00000001;
96 }
97
98 CREATE TABLE t2(c1 INT);
99 FLUSH LOGS;
100 CREATE TABLE t3(c1 INT);
101 FLUSH LOGS;
102 CREATE TABLE t4(c1 INT);
103
104 connection slave;
105 START SLAVE IO_THREAD;
106 source include/wait_for_slave_io_to_start.inc;
107
108 connection master;
109 sync_slave_with_master;
110 SHOW TABLES;
111
112 connection master;
113 DROP TABLE t1, t2, t3, t4;
114 --source include/rpl_end.inc