1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#18903155: BACKPORT BUG-18008907 TO 5.5+ VERSIONS.

Backporting patch committed for bug 18008907 to 5.5
and 5.6.
This commit is contained in:
Praveenkumar Hulakund
2014-06-27 17:04:08 +05:30
parent 70eca99172
commit b2c2656b62
6 changed files with 227 additions and 6 deletions

View File

@ -6292,6 +6292,7 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
{
DBUG_ENTER("fill_variables");
SHOW_VAR *sys_var_array;
int res= 0;
LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
@ -6305,10 +6306,21 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
schema_table_idx == SCH_GLOBAL_VARIABLES)
option_type= OPT_GLOBAL;
/*
Lock LOCK_plugin_delete to avoid deletion of any plugins while creating
SHOW_VAR array and hold it until all variables are stored in the table.
*/
mysql_mutex_lock(&LOCK_plugin_delete);
// Lock LOCK_system_variables_hash to prepare SHOW_VARs array.
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, upper_case_names, cond);
DEBUG_SYNC(thd, "acquired_LOCK_system_variables_hash");
sys_var_array= enumerate_sys_vars(thd, sorted_vars, option_type);
mysql_rwlock_unlock(&LOCK_system_variables_hash);
res= show_status_array(thd, wild, sys_var_array, option_type, NULL, "",
tables->table, upper_case_names, cond);
mysql_mutex_unlock(&LOCK_plugin_delete);
DBUG_RETURN(res);
}