diff options
author | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2023-01-30 10:49:33 -0700 |
---|---|---|
committer | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2023-01-31 08:14:26 -0700 |
commit | f981b53eb9d84689bb95fef943abcb3d2b42616b (patch) | |
tree | 19faa66ccc2f830c202f83ff2a476a253c16ef01 | |
parent | 2ed598eae8ebe737cdfa2aa2e7e6e0f3ad8d6ef7 (diff) | |
download | mariadb-git-f981b53eb9d84689bb95fef943abcb3d2b42616b.tar.gz |
MDEV-17516 Regressionbb-10.3-MDEV-17516
Replication lag issue using parallel replication
Test showing that after restart, SBM will start at
0, and then increase as soon as the IO thread
queues an event
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_mdev_17516.test | 77 | ||||
-rw-r--r-- | sql/slave.cc | 4 |
2 files changed, 81 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17516.test b/mysql-test/suite/rpl/t/rpl_mdev_17516.test new file mode 100644 index 00000000000..63b02614ada --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mdev_17516.test @@ -0,0 +1,77 @@ +# test for mdev-17516 +# +# Notes: +# 1) This test is mainly from the JIRA page, where it has only been slightly +# modified to be consistent and clear about the problematic report. +# 2) There is no result file yet, because this just shows the issue for now. +# + +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc +--source include/have_debug.inc + +# Test various aspects of parallel replication. + +--connection master +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection slave +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=4; +--source include/start_slave.inc + +--connection slave +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; + +--connection master +--disable_warnings +INSERT INTO t1 VALUES (1, SLEEP(4)); +--echo # Sleep 2 +--sleep 2 +INSERT INTO t1 VALUES (2, SLEEP(1)); +--save_master_pos + +--connection slave +set @@global.debug_dbug="+d,delay_next_io_thread_event"; + +--echo # Lock tables so the MDL cannot commit before we read SBM +lock tables t1 write; +--source include/start_slave.inc + +--echo # BUG: First report of SBM is 0 because SHOW SLAVE STATUS sees that +--echo # sql_thread_caught_up is true and parallel workers are not busy, as +--echo # the relay log is empty because the IO thread is delayed. +--let $status_items= Seconds_Behind_Master +--source include/show_slave_status.inc + +--echo # Match sleep of IO thread +sleep 3; +--echo # SBM should now jump to real value because worker thread has work +--let $status_items= Seconds_Behind_Master +--source include/show_slave_status.inc +unlock tables; +--sync_with_master + +--echo # We are caught up, SBM should be 0 +--let $status_items= Seconds_Behind_Master +--source include/show_slave_status.inc + +--connection master +drop table t1; +--save_master_pos + +--connection slave +set @@global.debug_dbug=""; +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/sql/slave.cc b/sql/slave.cc index 41e0e3c86eb..bff1a6b47ae 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4807,6 +4807,10 @@ Stopping slave I/O thread due to out-of-memory error from master"); tokenamount -= network_read_len; } + DBUG_EXECUTE_IF("delay_next_io_thread_event", { + sleep(3); + DBUG_SET("-d,delay_next_io_thread_event"); + }); if (queue_event(mi, event_buf, event_len)) { mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, NULL, |