Commit 9aa6042a authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-22696 Threadpool : make sure thd->event_scheduler.data does not change as...

MDEV-22696 Threadpool : make sure thd->event_scheduler.data does not change as long as THD is in server_threads.
parent 17437eb2
...@@ -211,12 +211,11 @@ void tp_callback(TP_connection *c) ...@@ -211,12 +211,11 @@ void tp_callback(TP_connection *c)
error: error:
c->thd= 0; c->thd= 0;
delete c;
if (thd) if (thd)
{ {
threadpool_remove_connection(thd); threadpool_remove_connection(thd);
} }
delete c;
worker_context.restore(); worker_context.restore();
} }
...@@ -243,9 +242,11 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) ...@@ -243,9 +242,11 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
return NULL; return NULL;
} }
delete connect; delete connect;
thd->event_scheduler.data = scheduler_data;
server_threads.insert(thd); server_threads.insert(thd);
thd->set_mysys_var(mysys_var); thd->set_mysys_var(mysys_var);
thd->event_scheduler.data= scheduler_data;
/* Login. */ /* Login. */
thread_attach(thd); thread_attach(thd);
...@@ -280,7 +281,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) ...@@ -280,7 +281,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
static void threadpool_remove_connection(THD *thd) static void threadpool_remove_connection(THD *thd)
{ {
thread_attach(thd); thread_attach(thd);
thd->event_scheduler.data= 0;
thd->net.reading_or_writing = 0; thd->net.reading_or_writing = 0;
end_connection(thd); end_connection(thd);
close_connection(thd, 0); close_connection(thd, 0);
......
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