summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index afd0c375718..a97ad06c7f6 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -693,7 +693,7 @@ extern "C" void thd_kill_timeout(THD* thd)
}
-THD::THD(my_thread_id id, bool is_wsrep_applier)
+THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0), rgi_fake(0), rgi_slave(NULL),
@@ -880,7 +880,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state(this);
- init();
+ init(skip_global_sys_var_lock);
#if defined(ENABLED_PROFILING)
profiling.set_thd(this);
#endif
@@ -1237,10 +1237,11 @@ extern "C" my_thread_id next_thread_id_noinline()
Init common variables that has to be reset on start and on change_user
*/
-void THD::init(void)
+void THD::init(bool skip_lock)
{
DBUG_ENTER("thd::init");
- mysql_mutex_lock(&LOCK_global_system_variables);
+ if (!skip_lock)
+ mysql_mutex_lock(&LOCK_global_system_variables);
plugin_thdvar_init(this);
/*
plugin_thd_var_init() sets variables= global_system_variables, which
@@ -1253,8 +1254,8 @@ void THD::init(void)
::strmake(variables.default_master_connection.str,
global_system_variables.default_master_connection.str,
variables.default_master_connection.length);
-
- mysql_mutex_unlock(&LOCK_global_system_variables);
+ if (!skip_lock)
+ mysql_mutex_unlock(&LOCK_global_system_variables);
user_time.val= start_time= start_time_sec_part= 0;