summaryrefslogtreecommitdiff
path: root/libmysqld/lib_sql.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 /libmysqld/lib_sql.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 'libmysqld/lib_sql.cc')
-rw-r--r--libmysqld/lib_sql.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index bcb45aefbfb..7855a5f2a73 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -667,8 +667,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
*/
void *create_embedded_thd(int client_flag)
{
- THD * thd= new THD;
- thd->thread_id= thd->variables.pseudo_thread_id= next_thread_id();
+ THD * thd= new THD(next_thread_id());
thd->thread_stack= (char*) &thd;
if (thd->store_globals())