diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/perfschema/pfs_variable.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/storage/perfschema/pfs_variable.cc b/storage/perfschema/pfs_variable.cc index 4dc193b3a1d..698ff1eca6c 100644 --- a/storage/perfschema/pfs_variable.cc +++ b/storage/perfschema/pfs_variable.cc @@ -562,13 +562,16 @@ void System_variable::init(THD *target_thd, const SHOW_VAR *show_var, /* Get the value of the system variable. */ String buf(m_value_str, sizeof(m_value_str) - 1, system_charset_info); - mysql_mutex_lock(&LOCK_global_system_variables); + if (query_scope == OPT_GLOBAL || system_var->scope() == sys_var::GLOBAL) + mysql_mutex_lock(&LOCK_global_system_variables); if (!system_var->val_str_nolock(&buf, target_thd, system_var->value_ptr(target_thd, query_scope, &null_clex_str))) buf.length(0); - mysql_mutex_unlock(&LOCK_global_system_variables); + + if (query_scope == OPT_GLOBAL || system_var->scope() == sys_var::GLOBAL) + mysql_mutex_unlock(&LOCK_global_system_variables); m_value_length= MY_MIN(buf.length(), SHOW_VAR_FUNC_BUFF_SIZE); |