File: rpl_manual_change_index_file.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (172 lines) | stat: -rw-r--r-- 5,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
source include/not_windows.inc;
--source include/not_group_replication_plugin.inc
source include/master-slave.inc;
CALL mtr.add_suppression("Failed to open log");
#
# BUG#28421 Infinite loop on slave relay logs
# 
# That, manually deleteing one or more entries from 'master-bin.index', will
# cause master infinitely loop to send one binlog file.
# 
# Manually changing index file is a illegal action, so when this happen, we
# send a fatal error to slave and close the dump session.

FLUSH LOGS;
# Now, 2 entries in index file.
# ./master-bin.000001
# ./master-bin.000002

CREATE TABLE t1(c1 INT);
# Now, the current dump file(master-bin.000002) is the second line of index
# file
--source include/sync_slave_sql_with_master.inc
# Now, all events has been replicate to slave. As current dump file
# (master-bin.000002) is the last binlog file, so master is waiting for new
# events.

connection master;
# Delete './master-bin.000001' from index file.
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
let $file= $MYSQLD_DATADIR/master-bin.index;
source include/truncate_file.inc;

if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
{
append_file $MYSQLD_DATADIR/master-bin.index;
./master-bin.000002
EOF
sleep 0.00000001;
}

if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
{
append_file $MYSQLD_DATADIR/master-bin.index;
.\master-bin.000002
EOF
sleep 0.00000001;
}

# Now, only 1 entry in index file.  ./master-bin.000002

# Generate master-bin.000003, but it is in the second line.
FLUSH LOGS;
# Now, 2 entries in index file.
# ./master-bin.000002
# ./master-bin.000003

# Now, master know that new binlog file(master-bin.000003) has been generated.
# It expects that the new binlog file is in third line of index file, but
# there is no third line in index file. It is so strange that master sends an
# error to slave. 
call mtr.add_suppression('Got fatal error 1236 from source when reading data from binary log: .*could not find next log');
connection slave;
# 13114 = ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG
--let $slave_io_errno= 13114
--let $show_slave_io_error= 1
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--source include/wait_for_slave_io_error.inc

connection master;

source include/truncate_file.inc;

if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
{
append_file $MYSQLD_DATADIR/master-bin.index;
./master-bin.000001
./master-bin.000002
./master-bin.000003
EOF
sleep 0.00000001;
}

if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
{
append_file $MYSQLD_DATADIR/master-bin.index;
.\master-bin.000001
.\master-bin.000002
.\master-bin.000003
EOF
sleep 0.00000001;
}

CREATE TABLE t2(c1 INT);
FLUSH LOGS;
CREATE TABLE t3(c1 INT);
FLUSH LOGS;
CREATE TABLE t4(c1 INT);

connection slave;
START SLAVE IO_THREAD;
source include/wait_for_slave_io_to_start.inc;

connection master;
--source include/sync_slave_sql_with_master.inc
SHOW TABLES;

connection master;
DROP TABLE t1, t2, t3, t4;
--source include/sync_slave_sql_with_master.inc

--echo
--echo # BUG#21437 server_errno=29 error message flood mysqld error log
--echo # --------------------------------------------------------------------------
--echo # This test verifies if the ER_SOURCE_FATAL_ERROR_READING_BINLOG which
--echo # insteads of EE_FILENOTFOUND error is sent to slave, so that the slave
--echo # I/O thread stops immediately.

--source include/rpl_reset.inc
connection master;
--echo [ on master ]
call mtr.add_suppression("Got fatal error 1236 from source when reading data from binary log:");
let $MASTER_DATADIR= `SELECT @@DATADIR`;
CREATE TABLE t1(c1 int);
DROP TABLE t1;

FLUSH LOGS;

CREATE TABLE t2(c1 int);
DROP TABLE t2;
--source include/sync_slave_sql_with_master.inc
--echo [ on slave ]
source include/stop_slave.inc;

connection master;
--echo [ on master ]
--echo # This operation will result in error EE_FILENOTFOUND which happens
--echo # when slave IO thread is connecting to master.
move_file $MASTER_DATADIR/master-bin.000001 $MASTER_DATADIR/master-bin.bak;

connection slave;
--echo [ on slave ]
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_LOG_FILE='master-bin.000001';
START SLAVE IO_THREAD;
--echo # Instead of EE_FILENOTFOUND, ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG
--echo # and the specific information are sent to slave.
--let $slave_io_errno= 13114
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc

connection master;
--echo [ on master ]
--echo # Restore master-bin.000001 file
move_file $MASTER_DATADIR/master-bin.bak $MASTER_DATADIR/master-bin.000001;

connection slave;
--echo [ on slave ]
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_LOG_FILE='master-bin.000002';
source include/start_slave.inc;

connection master;
--echo [ on master ]
CREATE TABLE t1(c1 INT);
--source include/sync_slave_sql_with_master.inc
--echo [ on slave ]
SELECT * FROM t1;

connection master;
DROP TABLE t1;

--source include/rpl_end.inc