summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-04-07 19:51:40 +0300
committerSergei Golubchik <serg@mariadb.org>2016-06-04 09:06:00 +0200
commit89685d55d7329065607df5a5f19b641e5947e22f (patch)
tree9c2f48944f77c71043b35ed1bc39555588be383c /sql/event_scheduler.cc
parent54f3e18f6e88bfae993749569104b4c89f0ea9ab (diff)
downloadmariadb-git-89685d55d7329065607df5a5f19b641e5947e22f.tar.gz
Reuse THD for new user connections
- To ensure that mallocs are marked for the correct THD, even if it's allocated in another thread, I added the thread_id to the THD constructor - Added st_my_thread_var to thr_lock_info_init() to avoid a call to my_thread_var - Moved things from THD::THD() to THD::init() - Moved some things to THD::cleanup() - Added THD::free_connection() and THD::reset_for_reuse() - Added THD to CONNECT::create_thd() - Added THD::thread_dbug_id and st_my_thread_var->dbug_id. These are needed to ensure that we have a constant thread_id used for debugging with a THD, even if it changes thread_id (=connection_id) - Set variables.pseudo_thread_id in constructor. Removed not needed sets.
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 6a8bdabb948..ea0163e3f78 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -189,7 +189,6 @@ pre_init_event_thread(THD* thd)
thd->net.read_timeout= slave_net_timeout;
thd->variables.option_bits|= OPTION_AUTO_IS_NULL;
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
- thd->thread_id= thd->variables.pseudo_thread_id= next_thread_id();
/*
Guarantees that we will see the thread in SHOW PROCESSLIST though its
@@ -396,7 +395,7 @@ Event_scheduler::start(int *err_no)
if (state > INITIALIZED)
goto end;
- if (!(new_thd= new THD))
+ if (!(new_thd= new THD(next_thread_id())))
{
sql_print_error("Event Scheduler: Cannot initialize the scheduler thread");
ret= true;
@@ -542,7 +541,7 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
int res= 0;
DBUG_ENTER("Event_scheduler::execute_top");
- if (!(new_thd= new THD()))
+ if (!(new_thd= new THD(next_thread_id())))
goto error;
pre_init_event_thread(new_thd);