mariadb/mysql-test/suite/rpl/r/rpl_binlog_directory.result
Kristian Nielsen 0a68328673 MDEV-34705: Binlog-in-engine: Protect against concurrent RESET MASTER and dump threads
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>
2025-06-11 11:32:10 +02:00

49 lines
1.2 KiB
Text

include/master-slave.inc
[connection master]
*** Test the --binlog-directory variable with legacy binlog.
connection slave;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=Slave_pos;
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1, 10);
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1 parameters: --binlog-directory=binlog_dir]
INSERT INTO t1 VALUES (2, 11);
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
INSERT INTO t1 VALUES (3, 12);
include/save_master_gtid.inc
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
master-bin.000002 #
*** Contents of master-bin.index (including directory path):
./master-bin.000001
binlog_dir/master-bin.000002
./master-bin.000002
SELECT * FROM t1 ORDER BY a;
a b
1 10
2 11
3 12
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 10
2 11
3 12
connection slave;
include/stop_slave.inc
SET GLOBAL gtid_slave_pos= '';
connection master;
include/kill_binlog_dump_threads.inc
RESET MASTER;
connection slave;
include/start_slave.inc
connection master;
DROP TABLE t1;
include/rpl_end.inc