Commit 7a50ce1d authored by Michael Widenius's avatar Michael Widenius

Use LOCK_show_status when we add things to all_status_vars

This was missing in my last commit for fixing possible lockups in SHOW STATUS.

sql/log.cc:
  Fixed comment
sql/sql_show.cc:
  Use LOCK_show_status when we add things to all_status_vars
sql/sql_test.cc:
  Remove not needed mutex_lock
parent 50e67fe3
...@@ -9640,7 +9640,7 @@ set_binlog_snapshot_file(const char *src) ...@@ -9640,7 +9640,7 @@ set_binlog_snapshot_file(const char *src)
Copy out current values of status variables, for SHOW STATUS or Copy out current values of status variables, for SHOW STATUS or
information_schema.global_status. information_schema.global_status.
This is called only under LOCK_status, so we can fill in a static array. This is called only under LOCK_show_status, so we can fill in a static array.
*/ */
void void
TC_LOG_BINLOG::set_status_variables(THD *thd) TC_LOG_BINLOG::set_status_variables(THD *thd)
......
...@@ -2846,7 +2846,7 @@ int add_status_vars(SHOW_VAR *list) ...@@ -2846,7 +2846,7 @@ int add_status_vars(SHOW_VAR *list)
{ {
int res= 0; int res= 0;
if (status_vars_inited) if (status_vars_inited)
mysql_mutex_lock(&LOCK_status); mysql_mutex_lock(&LOCK_show_status);
if (!all_status_vars.buffer && // array is not allocated yet - do it now if (!all_status_vars.buffer && // array is not allocated yet - do it now
my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 200, 20, MYF(0))) my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 200, 20, MYF(0)))
{ {
...@@ -2861,7 +2861,7 @@ int add_status_vars(SHOW_VAR *list) ...@@ -2861,7 +2861,7 @@ int add_status_vars(SHOW_VAR *list)
sort_dynamic(&all_status_vars, show_var_cmp); sort_dynamic(&all_status_vars, show_var_cmp);
err: err:
if (status_vars_inited) if (status_vars_inited)
mysql_mutex_unlock(&LOCK_status); mysql_mutex_unlock(&LOCK_show_status);
return res; return res;
} }
...@@ -2923,7 +2923,7 @@ void remove_status_vars(SHOW_VAR *list) ...@@ -2923,7 +2923,7 @@ void remove_status_vars(SHOW_VAR *list)
{ {
if (status_vars_inited) if (status_vars_inited)
{ {
mysql_mutex_lock(&LOCK_status); mysql_mutex_lock(&LOCK_show_status);
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *); SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
for (; list->name; list++) for (; list->name; list++)
...@@ -2944,7 +2944,7 @@ void remove_status_vars(SHOW_VAR *list) ...@@ -2944,7 +2944,7 @@ void remove_status_vars(SHOW_VAR *list)
} }
} }
shrink_var_array(&all_status_vars); shrink_var_array(&all_status_vars);
mysql_mutex_unlock(&LOCK_status); mysql_mutex_unlock(&LOCK_show_status);
} }
else else
{ {
......
...@@ -575,7 +575,6 @@ void mysql_print_status() ...@@ -575,7 +575,6 @@ void mysql_print_status()
/* Print key cache status */ /* Print key cache status */
puts("\nKey caches:"); puts("\nKey caches:");
process_key_caches(print_key_cache_status, 0); process_key_caches(print_key_cache_status, 0);
mysql_mutex_lock(&LOCK_status);
printf("\nhandler status:\n\ printf("\nhandler status:\n\
read_key: %10lu\n\ read_key: %10lu\n\
read_next: %10lu\n\ read_next: %10lu\n\
...@@ -591,7 +590,6 @@ update: %10lu\n", ...@@ -591,7 +590,6 @@ update: %10lu\n",
tmp.ha_write_count, tmp.ha_write_count,
tmp.ha_delete_count, tmp.ha_delete_count,
tmp.ha_update_count); tmp.ha_update_count);
mysql_mutex_unlock(&LOCK_status);
printf("\nTable status:\n\ printf("\nTable status:\n\
Opened tables: %10lu\n\ Opened tables: %10lu\n\
Open tables: %10lu\n\ Open tables: %10lu\n\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment