1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00
Files
mariadb/mysql-test/suite/s3/replication_delayed.test
Kristian Nielsen 84da20e658 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-07-23 16:19:50 +02:00

121 lines
2.2 KiB
Plaintext

--source include/have_s3.inc
--source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--source include/have_sequence.inc
# First clear the binlog
connection slave;
--source include/stop_slave.inc
connection master;
set binlog_format=mixed;
--source include/kill_binlog_dump_threads.inc
RESET MASTER;
connection slave;
--source include/start_slave.inc
set binlog_format=mixed;
RESET MASTER;
connection master;
#
# Create unique database for running the tests
#
--source create_database.inc
sync_slave_with_master;
--replace_result $database database
--eval use $database
connection master;
--echo #
--echo # MDEV-23691 S3 storage engine: delayed slave can drop the table
--echo #
connection slave;
stop slave;
connection master;
#
# Create version 1 of the table
#
create /*or replace*/ table t100 (
pk varchar(100)
) engine = 'innodb';
insert into t100 values ('old data');
alter table t100 engine=s3;
#
# Create version 2 of the table
#
drop table t100;
create /*or replace*/ table t100 (
pk varchar(100)
) engine= innodb;
insert into t100 select 'new data' from seq_1_to_10;
alter table t100 engine=s3;
select count(*), 'before slave start' from t100;
#
# Now, start the slave
#
connection slave;
start slave;
connection master;
sync_slave_with_master;
#select count(*) from t100;
connection master;
flush tables;
select count(*), 'after slave start' from t100;
show create table t100;
connection slave;
select count(*) from t100;
connection master;
drop table t100;
--echo #
--echo # Test delayed slave with inserts
--echo #
# Stop slave
connection slave;
stop slave;
connection master;
# Create tables with data while slave is stopped
create table t1 (a int) engine=innodb;
insert into t1 values (1),(2),(3);
insert into t1 select * from seq_4_to_6;
alter table t1 engine=s3;
connection slave;
start slave;
connection master;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
--echo #
--echo # Check slave binary log
--echo #
sync_slave_with_master;
--let $binlog_database=$database
--source include/show_binlog_events.inc
connection master;
--echo #
--echo # clean up
--echo #
--source drop_database.inc
--source include/rpl_end.inc