1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Don't use LOCK_status for the duration of SHOW STATUS because of possible lookups.

Instead we use LOCK_status only to protect summary of thread statistics and use a new mutex, LOCK_show_status
to protect concurrent SHOW STATUS.

sql/mysqld.cc:
  Add LOCK_show_status
  Don't free LOCK_status while calculating status variables.
sql/mysqld.h:
  Add LOCK_show_status
sql/sql_show.cc:
  Use LOCK_show_status to protect SHOW STATUS instead of LOCK_status.
This commit is contained in:
Michael Widenius
2014-09-12 14:49:13 +03:00
parent 9276e0e911
commit e36d6f03a4
3 changed files with 19 additions and 13 deletions

View File

@ -7342,14 +7342,20 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
if (partial_cond)
partial_cond->val_int();
mysql_mutex_lock(&LOCK_status);
if (option_type == OPT_GLOBAL)
{
/* We only hold LOCK_status for summary status vars */
mysql_mutex_lock(&LOCK_status);
calc_sum_of_all_status(&tmp);
mysql_mutex_unlock(&LOCK_status);
}
mysql_mutex_lock(&LOCK_show_status);
res= show_status_array(thd, wild,
(SHOW_VAR *)all_status_vars.buffer,
option_type, tmp1, "", tables->table,
upper_case_names, partial_cond);
mysql_mutex_unlock(&LOCK_status);
mysql_mutex_unlock(&LOCK_show_status);
DBUG_RETURN(res);
}