Commit 43378f36 authored by Kristian Nielsen's avatar Kristian Nielsen Committed by Sergei Golubchik

MDEV-10271: Stopped SQL slave thread doesn't print a message to error log like IO thread does

Make the slave SQL thread always output to the error log the message "Slave
SQL thread exiting, replication stopped in ..." whenever it previously
outputted "Slave SQL thread initialized, starting replication ...".

Before this patch, it was somewhat inconsistent in which cases the message
would be output and in which not, depending on the exact time and cause of
the condition that caused the SQL thread to stop.
parent 670b8580
...@@ -4574,11 +4574,11 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4574,11 +4574,11 @@ pthread_handler_t handle_slave_sql(void *arg)
{ {
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL, rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
"Error initializing relay log position: %s", errmsg); "Error initializing relay log position: %s", errmsg);
goto err; goto err_before_start;
} }
rli->reset_inuse_relaylog(); rli->reset_inuse_relaylog();
if (rli->alloc_inuse_relaylog(rli->group_relay_log_name)) if (rli->alloc_inuse_relaylog(rli->group_relay_log_name))
goto err; goto err_before_start;
strcpy(rli->future_event_master_log_name, rli->group_master_log_name); strcpy(rli->future_event_master_log_name, rli->group_master_log_name);
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
...@@ -4738,6 +4738,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4738,6 +4738,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
} }
} }
err:
if (mi->using_parallel()) if (mi->using_parallel())
rli->parallel.wait_for_done(thd, rli); rli->parallel.wait_for_done(thd, rli);
...@@ -4757,15 +4758,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4757,15 +4758,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
tmp.c_ptr_safe()); tmp.c_ptr_safe());
} }
err: err_before_start:
/*
Once again, in case we aborted with an error and skipped the first one.
(We want the first one to be before the printout of stop position to
get the correct position printed.)
*/
if (mi->using_parallel())
rli->parallel.wait_for_done(thd, rli);
/* /*
Some events set some playgrounds, which won't be cleared because thread Some events set some playgrounds, which won't be cleared because thread
......
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