1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

perfschema thread instrumentation related changes

This commit is contained in:
Sergei Golubchik
2020-02-14 16:47:59 +01:00
parent 0d837e8153
commit 6ded554fc2
7 changed files with 76 additions and 36 deletions

View File

@ -1689,6 +1689,8 @@ THD::~THD()
DBUG_ENTER("~THD()");
/* Make sure threads are not available via server_threads. */
assert_not_linked();
if (m_psi)
PSI_CALL_set_thread_THD(m_psi, 0);
/*
In error cases, thd may not be current thd. We have to fix this so
@ -4835,6 +4837,7 @@ MYSQL_THD create_background_thd()
auto thd_mysysvar= pthread_getspecific(THR_KEY_mysys);
auto thd= new THD(0);
pthread_setspecific(THR_KEY_mysys, save_mysysvar);
thd->set_psi(PSI_CALL_get_thread());
/*
Workaround the adverse effect of incrementing thread_count
@ -7794,3 +7797,8 @@ bool THD::timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts,
}
return 0;
}
THD_list_iterator *THD_list_iterator::iterator()
{
return &server_threads;
}