mirror of
https://github.com/MariaDB/server.git
synced 2025-09-12 04:12:27 +02:00

This is actually an existing problem in the old binlog implementation, and this patch is applicable to old binlog also. The problem is that RESET MASTER can run concurrently with binlog dump threads / connected slaves. This will remove the binlog from under the feet of the reader, which can cause all sorts of strange behaviour. This patch fixes the problem by disallowing to run RESET MASTER when dump threads (or other RESET MASTER or SHOW BINARY LOGS) are running. An error is thrown in this case, user must stop slaves and/or kill dump threads to make the RESET MASTER go through. A slave that connects in the middle of RESET MASTER will wait for it to complete. Fix a lot of test cases to kill any lingering dump threads before doing RESET MASTER, mostly just by sourcing include/kill_binlog_dump_threads.inc. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
66 lines
2.1 KiB
Text
66 lines
2.1 KiB
Text
--source include/have_binlog_format_mixed.inc
|
|
--source include/master-slave.inc
|
|
|
|
--echo *** Test the --binlog-directory variable with legacy binlog.
|
|
|
|
--connection slave
|
|
# Stop the slave while restarting master, just to not have to worry about
|
|
# any connect/re-connect tries. We are testing the location of the binlog,
|
|
# not the slave re-connect abilities.
|
|
--source include/stop_slave.inc
|
|
CHANGE MASTER TO master_use_gtid=Slave_pos;
|
|
|
|
--connection master
|
|
--let $master_datadir= `SELECT @@datadir`
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
|
|
|
INSERT INTO t1 VALUES (1, 10);
|
|
|
|
# Test that the master can be restarted with binlogs in a separate
|
|
# directory specificed by --binlog-directory.
|
|
--let $rpl_server_number= 1
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--mkdir $master_datadir/binlog_dir
|
|
--copy_file $master_datadir/master-bin.000001 $master_datadir/binlog_dir/master-bin.000001
|
|
--copy_file $master_datadir/master-bin.000001.idx $master_datadir/binlog_dir/master-bin.000001.idx
|
|
--move_file $master_datadir/master-bin.state $master_datadir/binlog_dir/master-bin.state
|
|
--let $rpl_server_parameters= --binlog-directory=binlog_dir
|
|
--source include/rpl_start_server.inc
|
|
|
|
INSERT INTO t1 VALUES (2, 11);
|
|
|
|
# Move master back to using the standard binlog directory.
|
|
--source include/rpl_stop_server.inc
|
|
--move_file $master_datadir/binlog_dir/master-bin.state $master_datadir/master-bin.state
|
|
--let $rpl_server_parameters=
|
|
--source include/rpl_start_server.inc
|
|
|
|
INSERT INTO t1 VALUES (3, 12);
|
|
--source include/save_master_gtid.inc
|
|
--source include/show_binary_logs.inc
|
|
--echo *** Contents of master-bin.index (including directory path):
|
|
--cat_file $master_datadir/master-bin.index
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
--connection slave
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
# Clean up.
|
|
--connection slave
|
|
--source include/stop_slave.inc
|
|
SET GLOBAL gtid_slave_pos= '';
|
|
|
|
--connection master
|
|
--source include/kill_binlog_dump_threads.inc
|
|
RESET MASTER;
|
|
--rmdir $master_datadir/binlog_dir
|
|
|
|
--connection slave
|
|
--source include/start_slave.inc
|
|
|
|
--connection master
|
|
DROP TABLE t1;
|
|
--source include/rpl_end.inc
|