1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2021-09-06 10:31:32 +03:00
22 changed files with 257 additions and 92 deletions

View File

@ -4901,11 +4901,13 @@ void destroy_thd(MYSQL_THD thd)
extern "C" pthread_key(struct st_my_thread_var *, THR_KEY_mysys);
MYSQL_THD create_background_thd()
{
DBUG_ASSERT(!current_thd);
auto save_thd = current_thd;
set_current_thd(nullptr);
auto save_mysysvar= pthread_getspecific(THR_KEY_mysys);
/*
Allocate new mysys_var specifically this THD,
Allocate new mysys_var specifically new THD,
so that e.g safemalloc, DBUG etc are happy.
*/
pthread_setspecific(THR_KEY_mysys, 0);
@ -4913,7 +4915,8 @@ 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());
thd->set_psi(nullptr);
set_current_thd(save_thd);
/*
Workaround the adverse effect of incrementing thread_count