diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-02-14 16:47:59 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-03-10 19:24:23 +0100 |
commit | 6ded554fc27578f94b08c7d0443ba767fc55bcec (patch) | |
tree | f02298143c791e8e3aef892e12d989ea0f7bb4d6 /sql/sql_connect.cc | |
parent | 0d837e8153a7bbb2b4452283076d930196a271d0 (diff) | |
download | mariadb-git-6ded554fc27578f94b08c7d0443ba767fc55bcec.tar.gz |
perfschema thread instrumentation related changes
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 7a8a2f7533a..c02e595717d 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1435,6 +1435,10 @@ end_thread: !(connect= cache_thread(thd))) break; + /* Create new instrumentation for the new THD job */ + PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection, thd, + thd->thread_id)); + if (!(connect->create_thd(thd))) { /* Out of resources. Free thread to get more resources */ @@ -1449,13 +1453,6 @@ end_thread: */ thd->store_globals(); - /* - Create new instrumentation for the new THD job, - and attach it to this running pthread. - */ - PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection, - thd, thd->thread_id)); - /* reset abort flag for the thread */ thd->mysys_var->abort= 0; thd->thr_create_utime= microsecond_interval_timer(); @@ -1576,5 +1573,14 @@ THD *CONNECT::create_thd(THD *thd) thd->scheduler= scheduler; thd->real_id= pthread_self(); /* Duplicates THD::store_globals() setting. */ + + /* Attach PSI instrumentation to the new THD */ + + PSI_thread *psi= PSI_CALL_get_thread(); + PSI_CALL_set_thread_os_id(psi); + PSI_CALL_set_thread_THD(psi, thd); + PSI_CALL_set_thread_id(psi, thd->thread_id); + thd->set_psi(psi); + DBUG_RETURN(thd); } |