Skip to content

Commit 9aa6042

Browse files
committed
MDEV-22696 Threadpool : make sure thd->event_scheduler.data does not change as long as THD is in server_threads.
1 parent 17437eb commit 9aa6042

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sql/threadpool_common.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,11 @@ void tp_callback(TP_connection *c)
211211

212212
error:
213213
c->thd= 0;
214-
delete c;
215-
216214
if (thd)
217215
{
218216
threadpool_remove_connection(thd);
219217
}
218+
delete c;
220219
worker_context.restore();
221220
}
222221

@@ -243,9 +242,11 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
243242
return NULL;
244243
}
245244
delete connect;
245+
246+
thd->event_scheduler.data = scheduler_data;
246247
server_threads.insert(thd);
247248
thd->set_mysys_var(mysys_var);
248-
thd->event_scheduler.data= scheduler_data;
249+
249250

250251
/* Login. */
251252
thread_attach(thd);
@@ -280,7 +281,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
280281
static void threadpool_remove_connection(THD *thd)
281282
{
282283
thread_attach(thd);
283-
thd->event_scheduler.data= 0;
284284
thd->net.reading_or_writing = 0;
285285
end_connection(thd);
286286
close_connection(thd, 0);

0 commit comments

Comments
 (0)