mariadb/mysql-test/suite/rpl/t/rpl_blackhole_row_annotate.test
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

54 lines
2 KiB
Text

# ==== Purpose ====
#
# Test verifies that when "replicate_annotate_row_events" are enabled on slave
# the DML operations on blackhole engine will be successful. It also ensures
# that Annotate events are logged into slave's binary log.
#
# ==== Implementation ====
#
# Steps:
# 0 - Enable "replicate_annotate_row_events" on slave and do DML operations
# on master.
# 1 - Slave server will successfully apply the DML operations and it is in
# sync with master.
# 2 - Verify that the "show binlog events" prints all annotate events.
# 3 - Stream the slave's binary log using "mysqlbinlog" tool and verify
# that the Annotate events are being displayed.
#
# ==== References ====
#
# MDEV-11094: Blackhole table updates on slave fail when row annotation is
# enabled
source include/have_blackhole.inc;
source include/have_binlog_format_row.inc;
source include/binlog_start_pos.inc;
source include/master-slave.inc;
connection slave;
source include/stop_slave.inc;
connection master;
source include/kill_binlog_dump_threads.inc;
SET timestamp=1000000000;
RESET MASTER;
connection slave;
source include/start_slave.inc;
SET timestamp=1000000000;
RESET MASTER;
connection master;
source include/rpl_blackhole_basic.test;
# Verify on slave.
connection slave;
FLUSH LOGS;
--replace_column 2 # 5 #
--replace_result $binlog_start_pos <start_pos>
--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
--eval show binlog events in 'slave-bin.000001' from $binlog_start_pos
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /xid=\d*/xid=<xid>/
--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-gtid-strict-mode $MYSQLD_DATADIR/slave-bin.000001
source include/rpl_end.inc;