summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2020-01-17 20:26:14 +0200
committerSachin Kumar <sachin.setiya@mariadb.com>2021-05-14 11:49:26 +0100
commit3616640a3149b318e0d5602dd39f05e309514dbb (patch)
tree3655a06b8b6dbe4aefcac05e5b9ff6f7e237e0b5 /sql/slave.cc
parentec348f555b674f6af083923cbdd1bb0847b35493 (diff)
downloadmariadb-git-3616640a3149b318e0d5602dd39f05e309514dbb.tar.gz
MDEV-20821 parallel slave server shutdown hang
Parallel slave server shutdown found to be hanging in close_connections() triggered by shutdown due to a slave worker thread would not be notified to exit in case the worker was sitting idle. Fixed with destroying the worker pool earlier that is in slave_prepare_for_shutdown() when all their driver threads have already left. A test file is added to simulate the bug condition as well as check multi-sourced and not-idle worker cases.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 3124b2d10ab..8e26301d926 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -975,6 +975,9 @@ void slave_prepare_for_shutdown()
mysql_mutex_lock(&LOCK_active_mi);
master_info_index->free_connections();
mysql_mutex_unlock(&LOCK_active_mi);
+ // It's safe to destruct worker pool now when
+ // all driver threads are gone.
+ global_rpl_thread_pool.destroy();
}
/*