Skip to content

Commit

Permalink
MDEV-22696 Threadpool : make sure thd->event_scheduler.data does not …
Browse files Browse the repository at this point in the history
…change as long as THD is in server_threads.
  • Loading branch information
vaintroub committed May 25, 2020
1 parent 17437eb commit 9aa6042
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sql/threadpool_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,11 @@ void tp_callback(TP_connection *c)

error:
c->thd= 0;
delete c;

if (thd)
{
threadpool_remove_connection(thd);
}
delete c;
worker_context.restore();
}

Expand All @@ -243,9 +242,11 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
return NULL;
}
delete connect;

thd->event_scheduler.data = scheduler_data;
server_threads.insert(thd);
thd->set_mysys_var(mysys_var);
thd->event_scheduler.data= scheduler_data;


/* Login. */
thread_attach(thd);
Expand Down Expand Up @@ -280,7 +281,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
static void threadpool_remove_connection(THD *thd)
{
thread_attach(thd);
thd->event_scheduler.data= 0;
thd->net.reading_or_writing = 0;
end_connection(thd);
close_connection(thd, 0);
Expand Down

0 comments on commit 9aa6042

Please sign in to comment.