summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-07-14 18:03:53 +0200
committerSergei Golubchik <serg@mariadb.org>2021-07-24 15:08:08 +0200
commit4533e6ef65b8785bc846317dd3b7870211baef26 (patch)
tree2184bb037981e8a1fd489a777aa84ff92da0cdff /sql/threadpool_common.cc
parentb34cafe9d9fb6029d7aa6c5c18ef51c577aa637a (diff)
downloadmariadb-git-4533e6ef65b8785bc846317dd3b7870211baef26.tar.gz
MDEV-18353 Shutdown may miss to wait for connection thread
* count CONNECT objects too * wait for all CONNECT objects to disappear (to be converted to THDs) before killing THDs away
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 3320b9fc0cc..4195bf21e48 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -222,6 +222,14 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
{
THD *thd= NULL;
+ DBUG_EXECUTE_IF("CONNECT_wait",
+ {
+ extern MYSQL_SOCKET unix_sock;
+ DBUG_ASSERT(unix_sock.fd >= 0);
+ while (unix_sock.fd >= 0)
+ my_sleep(1000);
+ });
+
/*
Create a new connection context: mysys_thread_var and PSI thread
Store them in THD.
@@ -247,8 +255,8 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
}
return NULL;
}
- delete connect;
- server_threads.insert(thd);
+ server_threads.insert(thd); // Make THD visible in show processlist
+ delete connect; // must be after server_threads.insert, see close_connections()
thd->set_mysys_var(mysys_var);
thd->event_scheduler.data= scheduler_data;