mirror of
https://github.com/MariaDB/server.git
synced 2025-08-27 13:04:36 +03:00
Major replication test framework cleanup. This does the following: - Ensure that all tests clean up the replication state when they finish, by making check-testcase check the output of SHOW SLAVE STATUS. This implies: - Slave must not be running after test finished. This is good because it removes the risk for sporadic errors in subsequent tests when a test forgets to sync correctly. - Slave SQL and IO errors must be cleared when test ends. This is good because we will notice if a test gets an unexpected error in the slave threads near the end. - We no longer have to clean up before a test starts. - Ensure that all tests that wait for an error in one of the slave threads waits for a specific error. It is no longer possible to source wait_for_slave_[sql|io]_to_stop.inc when there is an error in one of the slave threads. This is good because: - If a test expects an error but there is a bug that causes another error to happen, or if it stops the slave thread without an error, then we will notice. - When developing tests, wait_for_*_to_[start|stop].inc will fail immediately if there is an error in the relevant slave thread. Before this patch, we had to wait for the timeout. - Remove duplicated and repeated code for setting up unusual replication topologies. Now, there is a single file that is capable of setting up arbitrary topologies (include/rpl_init.inc, but include/master-slave.inc is still available for the most common topology). Tests can now end with include/rpl_end.inc, which will clean up correctly no matter what topology is used. The topology can be changed with include/rpl_change_topology.inc. - Improved debug information when tests fail. This includes: - debug info is printed on all servers configured by include/rpl_init.inc - User can set $rpl_debug=1, which makes auxiliary replication files print relevant debug info. - Improved documentation for all auxiliary replication files. Now they describe purpose, usage, parameters, and side effects. - Many small code cleanups: - Made have_innodb.inc output a sensible error message. - Moved contents of rpl000017-slave.sh into rpl000017.test - Added mysqltest variables that expose the current state of disable_warnings/enable_warnings and friends. - Too many to list here: see per-file comments for details.
107 lines
2.8 KiB
Plaintext
107 lines
2.8 KiB
Plaintext
source include/master-slave.inc;
|
|
|
|
#
|
|
# 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
|
|
sync_slave_with_master;
|
|
# 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 master when reading data from binary log: .*could not find next log');
|
|
connection slave;
|
|
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
|
|
--let $slave_io_errno= 1236
|
|
--let $show_slave_io_error= 1
|
|
--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;
|
|
sync_slave_with_master;
|
|
SHOW TABLES;
|
|
|
|
connection master;
|
|
DROP TABLE t1, t2, t3, t4;
|
|
--source include/rpl_end.inc
|