diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 4b11acf0f68..fa265de6af2 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -483,6 +483,19 @@ do_ftwrl_wait(rpl_group_info *rgi, mysql_cond_wait(&entry->COND_parallel_entry, &entry->LOCK_parallel_entry); } while (sub_id > entry->pause_sub_id); + DBUG_EXECUTE_IF("delay_ftwrl_wait_gtid_0_x_100", { + if (rgi->current_gtid.domain_id == 0 && + rgi->current_gtid.seq_no == 100) { + /* + Simulate delayed wakeup from the mysql_cond_wait(). To do this, we + need to have the LOCK_parallel_entry mutex released during the wait. + */ + mysql_mutex_unlock(&entry->LOCK_parallel_entry); + debug_sync_set_action(thd, + STRING_WITH_LEN("now SIGNAL pause_wait_started WAIT_FOR pause_wait_continue")); + mysql_mutex_lock(&entry->LOCK_parallel_entry); + } + }); /* We do not call EXIT_COND() here, as this will be done later by our caller (since we set *did_enter_cond to true). @@ -649,7 +662,17 @@ rpl_pause_for_ftwrl(THD *thd) mysql_mutex_unlock(&rpt->LOCK_rpl_thread); ++e->need_sub_id_signal; if (e->pause_sub_id == (uint64)ULONGLONG_MAX) + { e->pause_sub_id= e->largest_started_sub_id; + DBUG_EXECUTE_IF("pause_for_ftwrl_wait", { + mysql_mutex_unlock(&e->LOCK_parallel_entry); + debug_sync_set_action(thd, + STRING_WITH_LEN("now " + "SIGNAL pause_ftwrl_waiting " + "WAIT_FOR pause_ftwrl_cont")); + mysql_mutex_lock(&e->LOCK_parallel_entry); + }); + } thd->ENTER_COND(&e->COND_parallel_entry, &e->LOCK_parallel_entry, &stage_waiting_for_ftwrl_threads_to_pause, &old_stage); thd->set_time_for_next_stage(); @@ -1287,6 +1310,12 @@ handle_rpl_parallel_thread(void *arg) event_gtid_sub_id= rgi->gtid_sub_id; rgi->thd= thd; + DBUG_EXECUTE_IF("gco_wait_delay_gtid_0_x_99", { + if (rgi->current_gtid.domain_id == 0 && rgi->current_gtid.seq_no == 99) { + debug_sync_set_action(thd, + STRING_WITH_LEN("now SIGNAL gco_wait_paused WAIT_FOR gco_wait_cont")); + } }); + mysql_mutex_lock(&entry->LOCK_parallel_entry); skip_event_group= do_gco_wait(rgi, gco, &did_enter_cond, &old_stage);