mirror of
https://github.com/MariaDB/server.git
synced 2025-10-21 23:34:22 +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>
98 lines
2.8 KiB
Text
98 lines
2.8 KiB
Text
#
|
|
# Test Galera as a slave to a MariaDB master using GTIDs
|
|
#
|
|
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
|
|
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
|
|
#
|
|
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
|
|
#
|
|
|
|
--source include/have_innodb.inc
|
|
--source include/galera_cluster.inc
|
|
|
|
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
|
|
# we open the node_3 connection here
|
|
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
|
|
|
|
--connection node_2
|
|
--disable_query_log
|
|
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3;
|
|
--enable_query_log
|
|
START SLAVE;
|
|
|
|
--connection node_3
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
|
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
#multi stmt trans
|
|
begin;
|
|
insert into t2 values(21);
|
|
insert into t2 values(22);
|
|
commit;
|
|
|
|
SELECT @@global.gtid_binlog_state;
|
|
|
|
--connection node_2
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
|
|
--source include/wait_condition.inc
|
|
|
|
--let $wait_condition = SELECT COUNT(*) = 2 FROM t2;
|
|
--source include/wait_condition.inc
|
|
|
|
INSERT INTO t1 VALUES(2);
|
|
INSERT INTO t1 VALUES(3);
|
|
SELECT @@global.gtid_binlog_state;
|
|
|
|
--connection node_1
|
|
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
|
|
--source include/wait_condition.inc
|
|
|
|
INSERT INTO t1 VALUES(4);
|
|
SELECT @@global.gtid_binlog_state;
|
|
|
|
--connection node_3
|
|
DROP TABLE t1,t2;
|
|
|
|
#
|
|
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
|
|
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
|
|
# warning is also reported by MTR, which is also weird.
|
|
#
|
|
|
|
--sleep 1
|
|
|
|
--connection node_2
|
|
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--connection node_1
|
|
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
|
--source include/wait_condition.inc
|
|
|
|
--connection node_2
|
|
STOP SLAVE;
|
|
RESET SLAVE ALL;
|
|
SET GLOBAL wsrep_on=OFF;
|
|
--source include/kill_binlog_dump_threads.inc
|
|
reset master;
|
|
SET GLOBAL wsrep_on=ON;
|
|
|
|
--connection node_1
|
|
SET GLOBAL wsrep_on=OFF;
|
|
--source include/kill_binlog_dump_threads.inc
|
|
reset master;
|
|
SET GLOBAL wsrep_on=ON;
|
|
|
|
--connection node_3
|
|
--source include/kill_binlog_dump_threads.inc
|
|
reset master;
|
|
|
|
--connection node_2
|
|
CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
|