summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mysql/thread_pool_priv.h1
-rw-r--r--sql/sql_class.cc12
-rw-r--r--sql/sql_parse.cc10
3 files changed, 21 insertions, 2 deletions
diff --git a/include/mysql/thread_pool_priv.h b/include/mysql/thread_pool_priv.h
index babe0ab6c08..1368c8c52be 100644
--- a/include/mysql/thread_pool_priv.h
+++ b/include/mysql/thread_pool_priv.h
@@ -61,6 +61,7 @@ uint thd_get_net_read_write(THD *thd);
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
ulong thd_get_net_wait_timeout(THD *thd);
my_socket thd_get_fd(THD *thd);
+int thd_store_globals(THD* thd);
THD *first_global_thread();
THD *next_global_thread(THD *thd);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index e32844d06ea..9b0a76bf749 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -469,6 +469,18 @@ my_socket thd_get_fd(THD *thd)
}
/**
+ Set thread specific environment required for thd cleanup in thread pool.
+
+ @param thd THD object
+
+ @retval 1 if thread-specific enviroment could be set else 0
+*/
+int thd_store_globals(THD* thd)
+{
+ return thd->store_globals();
+}
+
+/**
Get thread attributes for connection threads
@retval Reference to thread attribute for connection threads
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ea07bfce0cb..7bbcff4bc2b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6471,8 +6471,14 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
if ((thd->security_ctx->master_access & SUPER_ACL) ||
thd->security_ctx->user_matches(tmp->security_ctx))
{
- tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION);
- error=0;
+ /* process the kill only if thread is not already undergoing any kill
+ connection.
+ */
+ if (tmp->killed != THD::KILL_CONNECTION)
+ {
+ tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION);
+ }
+ error= 0;
}
else
error=ER_KILL_DENIED_ERROR;