summaryrefslogtreecommitdiff
path: root/sql/rpl_parallel.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2014-01-03 12:20:53 +0100
committerunknown <knielsen@knielsen-hq.org>2014-01-03 12:20:53 +0100
commitc4e76b20a4da6f060b77b22b12c67b4b1f2b512c (patch)
tree168bbb796f4f0721a1e6bb11654d9a3591f80483 /sql/rpl_parallel.cc
parent86a2c03b51b2995a0f35ae448e3bf953b90060ad (diff)
downloadmariadb-git-c4e76b20a4da6f060b77b22b12c67b4b1f2b512c.tar.gz
MDEV-5363: Make parallel replication waits killable
Add another test case. This one for killing the SQL driver thread while it is waiting for room in the list of events queued for a worker thread. Fix bugs found: - Several memory leaks in various error cases. - SQL error code was not set (for SHOW SLAVE STATUS etc.) when killed.
Diffstat (limited to 'sql/rpl_parallel.cc')
-rw-r--r--sql/rpl_parallel.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 3cdd1f5ec8d..af44d79038c 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -801,6 +801,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
sql_thread_stopping= true;
if (sql_thread_stopping)
{
+ delete ev;
/* QQ: Need a better comment why we return false here */
return false;
}
@@ -809,6 +810,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
MYF(0))))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ delete ev;
return true;
}
qev->ev= ev;
@@ -831,6 +833,8 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
{
my_error(ER_OUT_OF_RESOURCES, MYF(MY_WME));
delete rgi;
+ my_free(qev);
+ delete ev;
return true;
}
rgi->is_parallel_exec = true;
@@ -903,6 +907,14 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
mysql_mutex_unlock(&cur_thread->LOCK_rpl_thread);
my_error(ER_CONNECTION_KILLED, MYF(0));
delete rgi;
+ my_free(qev);
+ delete ev;
+ DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max",
+ {
+ debug_sync_set_action(rli->sql_driver_thd,
+ STRING_WITH_LEN("now SIGNAL wait_queue_killed"));
+ };);
+ slave_output_error_info(rli, rli->sql_driver_thd);
return true;
}
else
@@ -918,6 +930,11 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
(&cur_thread->COND_rpl_thread, &cur_thread->LOCK_rpl_thread,
"Waiting for room in worker thread event queue");
did_enter_cond= true;
+ DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max",
+ {
+ debug_sync_set_action(rli->sql_driver_thd,
+ STRING_WITH_LEN("now SIGNAL wait_queue_ready"));
+ };);
}
mysql_cond_wait(&cur_thread->COND_rpl_thread,
&cur_thread->LOCK_rpl_thread);