summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2023-02-08 10:32:35 -0700
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2023-02-08 12:15:23 -0700
commit5c419027ed998d68a6d11904fe1219bca852e460 (patch)
tree5dcb1e3eb7172da025b2e4f5b2d4bb5550ea39b8 /sql/slave.cc
parent2743a510a156456fe57429032bf41c0da0f11198 (diff)
downloadmariadb-git-bb-10.3-MDEV-30608.tar.gz
MDEV-30608: rpl.rpl_delayed_parallel_slave_sbm sometimes fails with Seconds_Behind_Master should not have used second transaction timestampbb-10.3-MDEV-30608
One of the constraints added in the MDEV-29639 patch, is that only the first event after idling should update last_master_timestamp; and as long as the replica has more events to execute, the variable should not be updated. The corresponding test, rpl_delayed_parallel_slave_sbm.test, aims to verify this; however, if the IO thread takes too long to queue events, the SQL thread can appear to catch up too fast. This fix ensures that the relay log has been fully written before executing the events. Note that the underlying cause of this test failure needs to be addressed as a bug-fix, this is a temporary fix to stop test failures. To track work on the bug-fix for the underlying issue, please see MDEV-30619.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index b64b9a64979..3f547881045 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4112,6 +4112,21 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
int exec_res;
Log_event_type typ= ev->get_type_code();
+ DBUG_EXECUTE_IF(
+ "pause_sql_thread_on_next_event",
+ {
+ /*
+ Temporarily unlock data_lock so we can check-in with the IO thread
+ */
+ mysql_mutex_unlock(&rli->data_lock);
+ DBUG_ASSERT(!debug_sync_set_action(
+ thd,
+ STRING_WITH_LEN(
+ "now SIGNAL paused_on_event WAIT_FOR sql_thread_continue")));
+ DBUG_SET("-d,pause_sql_thread_on_next_event");
+ mysql_mutex_lock(&rli->data_lock);
+ });
+
/*
Even if we don't execute this event, we keep the master timestamp,
so that seconds behind master shows correct delta (there are events