mirror of
https://github.com/MariaDB/server.git
synced 2025-10-21 15:24:04 +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>
64 lines
1.1 KiB
Text
64 lines
1.1 KiB
Text
connection node_2;
|
|
connection node_1;
|
|
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
|
|
START SLAVE;
|
|
connection node_1;
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(1);
|
|
# Disable binary logging for current session
|
|
SET SQL_LOG_BIN=OFF;
|
|
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES(1);
|
|
INSERT INTO t1 VALUES(2);
|
|
CREATE TABLE test.t3 AS SELECT * from t1;
|
|
SET SQL_LOG_BIN=ON;
|
|
INSERT INTO t1 VALUES(3);
|
|
CREATE TABLE test.t4 AS SELECT * from t1;
|
|
connection node_2;
|
|
SELECT * FROM t1;
|
|
f1
|
|
1
|
|
2
|
|
3
|
|
SELECT * FROM t2;
|
|
f1
|
|
1
|
|
SELECT * FROM t3;
|
|
f1
|
|
1
|
|
2
|
|
SELECT * FROM t4;
|
|
f1
|
|
1
|
|
2
|
|
3
|
|
connection node_3;
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t1
|
|
t4
|
|
SELECT * FROM t1;
|
|
f1
|
|
1
|
|
3
|
|
SELECT * FROM t4;
|
|
f1
|
|
1
|
|
2
|
|
3
|
|
# Cleanup
|
|
connection node_1;
|
|
DROP TABLE t1, t4;
|
|
SET SQL_LOG_BIN=OFF;
|
|
DROP TABLE t2, t3;
|
|
connection node_3;
|
|
BINLOG_POSITIONS_MATCH
|
|
1
|
|
STOP SLAVE;
|
|
RESET SLAVE ALL;
|
|
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
|
|
connection node_1;
|
|
set global wsrep_on=OFF;
|
|
include/kill_binlog_dump_threads.inc
|
|
RESET MASTER;
|
|
set global wsrep_on=ON;
|