summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-08-10 19:19:05 +0200
committerSergei Golubchik <serg@mariadb.org>2016-08-10 19:19:05 +0200
commit309c08c17c56d35e5635a5874fb70719935e5f54 (patch)
treedb63b0f496364456789f390eb5f693dabf0f94a1 /sql/sql_show.cc
parentc6fdb92ca829fed893d9e7324e80b1450de16087 (diff)
parent5ad02062d928cccbd29c0a2db6f0f7ceb33195d1 (diff)
downloadmariadb-git-309c08c17c56d35e5635a5874fb70719935e5f54.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 97f6b863058..ea9f9ec2cca 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7409,19 +7409,30 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
enum enum_schema_tables schema_table_idx=
get_schema_table_idx(tables->schema_table);
- enum enum_var_type option_type= OPT_SESSION;
+ enum enum_var_type scope= OPT_SESSION;
bool upper_case_names= (schema_table_idx != SCH_VARIABLES);
bool sorted_vars= (schema_table_idx == SCH_VARIABLES);
if ((sorted_vars && lex->option_type == OPT_GLOBAL) ||
schema_table_idx == SCH_GLOBAL_VARIABLES)
- option_type= OPT_GLOBAL;
+ scope= OPT_GLOBAL;
COND *partial_cond= make_cond_for_info_schema(cond, tables);
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
- res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, option_type),
- option_type, NULL, "", tables->table,
+
+ /*
+ Avoid recursive LOCK_system_variables_hash acquisition in
+ intern_sys_var_ptr() by pre-syncing dynamic session variables.
+ */
+ if (scope == OPT_SESSION &&
+ (!thd->variables.dynamic_variables_ptr ||
+ global_system_variables.dynamic_variables_head >
+ thd->variables.dynamic_variables_head))
+ sync_dynamic_session_variables(thd, true);
+
+ res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
+ scope, NULL, "", tables->table,
upper_case_names, partial_cond);
mysql_rwlock_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res);