Commit eaa4968f authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-10653: Fix segfault in SHOW MASTER STATUS with NULL inuse_relaylog

The previous patch for MDEV-10653 changes the rpl_parallel::workers_idle()
function to use Relay_log_info::last_inuse_relaylog to check for idle
workers. But the code was missing a NULL check. Also, there was one place
during SQL slave thread start which was missing mutex synchronisation when
updating inuse_relaylog.
Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent 1cbba45e
......@@ -2538,8 +2538,10 @@ rpl_parallel::stop_during_until()
bool
rpl_parallel::workers_idle(Relay_log_info *rli)
{
return rli->last_inuse_relaylog->queued_count ==
rli->last_inuse_relaylog->dequeued_count;
mysql_mutex_assert_owner(&rli->data_lock);
return !rli->last_inuse_relaylog ||
rli->last_inuse_relaylog->queued_count ==
rli->last_inuse_relaylog->dequeued_count;
}
......
......@@ -5369,19 +5369,25 @@ pthread_handler_t handle_slave_sql(void *arg)
}
else
rli->gtid_skip_flag = GTID_SKIP_NOT;
mysql_mutex_lock(&rli->data_lock);
if (init_relay_log_pos(rli,
rli->group_relay_log_name,
rli->group_relay_log_pos,
1 /*need data lock*/, &errmsg,
0 /*need data lock*/, &errmsg,
1 /*look for a description_event*/))
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
"Error initializing relay log position: %s", errmsg);
mysql_mutex_unlock(&rli->data_lock);
goto err_before_start;
}
rli->reset_inuse_relaylog();
if (rli->alloc_inuse_relaylog(rli->group_relay_log_name))
{
mysql_mutex_unlock(&rli->data_lock);
goto err_before_start;
}
mysql_mutex_unlock(&rli->data_lock);
strcpy(rli->future_event_master_log_name, rli->group_master_log_name);
THD_CHECK_SENTRY(thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment