diff options
author | Monty <monty@mariadb.org> | 2016-04-07 19:51:40 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-04 09:06:00 +0200 |
commit | 89685d55d7329065607df5a5f19b641e5947e22f (patch) | |
tree | 9c2f48944f77c71043b35ed1bc39555588be383c /plugin | |
parent | 54f3e18f6e88bfae993749569104b4c89f0ea9ab (diff) | |
download | mariadb-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 'plugin')
-rw-r--r-- | plugin/feedback/sender_thread.cc | 6 | ||||
-rw-r--r-- | plugin/handler_socket/handlersocket/database.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index f7b9f440fcd..1b90d2cb340 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -89,7 +89,7 @@ static int prepare_for_fill(TABLE_LIST *tables) (every increment of global thread_id counts as a new connection in SHOW STATUS and we want to avoid skewing the statistics) */ - thd->thread_id= thd->variables.pseudo_thread_id= thd_thread_id; + thd->variables.pseudo_thread_id= thd->thread_id; mysql_mutex_lock(&LOCK_thread_count); thread_count++; threads.append(thd); @@ -205,10 +205,10 @@ static void send_report(const char *when) /* otherwise, prepare the THD and TABLE_LIST, create and fill the temporary table with data just like - SELECT * FROM IFROEMATION_SCHEMA.feedback is doing, + SELECT * FROM INFORMATION_SCHEMA.feedback is doing, read and concatenate table data into a String. */ - if (!(thd= new THD())) + if (!(thd= new THD(thd_thread_id))) return; if (prepare_for_fill(&tables)) diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 94eedbf6d04..28ce6c78876 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -278,7 +278,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag) DBG_THR(fprintf(stderr, "HNDSOCK init thread\n")); { my_thread_init(); - thd = new THD; + thd = new THD(0); thd->thread_stack = (char *)stack_bottom; DBG_THR(fprintf(stderr, "thread_stack = %p sizeof(THD)=%zu sizeof(mtx)=%zu " |