mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-15135 - Make LOCK_show_status rwlock, to enable parallelism of
fill_status. Also, remove LOCK_status around calc_sum_of_all_status() Also, rename LOCK_show_status into LOCK_all_status_vars. This reflects the variable the lock protects.
This commit is contained in:
committed by
Sergey Vojtovich
parent
8b4fcc434d
commit
c2318291be
@ -3383,7 +3383,7 @@ int add_status_vars(SHOW_VAR *list)
|
||||
{
|
||||
int res= 0;
|
||||
if (status_vars_inited)
|
||||
mysql_mutex_lock(&LOCK_show_status);
|
||||
mysql_rwlock_wrlock(&LOCK_all_status_vars);
|
||||
if (!all_status_vars.buffer && // array is not allocated yet - do it now
|
||||
my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 250, 50, MYF(0)))
|
||||
{
|
||||
@ -3398,7 +3398,7 @@ int add_status_vars(SHOW_VAR *list)
|
||||
sort_dynamic(&all_status_vars, show_var_cmp);
|
||||
err:
|
||||
if (status_vars_inited)
|
||||
mysql_mutex_unlock(&LOCK_show_status);
|
||||
mysql_rwlock_unlock(&LOCK_all_status_vars);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -3460,7 +3460,7 @@ void remove_status_vars(SHOW_VAR *list)
|
||||
{
|
||||
if (status_vars_inited)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_show_status);
|
||||
mysql_rwlock_wrlock(&LOCK_all_status_vars);
|
||||
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
|
||||
|
||||
for (; list->name; list++)
|
||||
@ -3481,7 +3481,7 @@ void remove_status_vars(SHOW_VAR *list)
|
||||
}
|
||||
}
|
||||
shrink_var_array(&all_status_vars);
|
||||
mysql_mutex_unlock(&LOCK_show_status);
|
||||
mysql_rwlock_unlock(&LOCK_all_status_vars);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7836,18 +7836,15 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
|
||||
if (scope == 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);
|
||||
mysql_rwlock_rdlock(&LOCK_all_status_vars);
|
||||
res= show_status_array(thd, wild,
|
||||
(SHOW_VAR *)all_status_vars.buffer,
|
||||
scope, tmp1, "", tables->table,
|
||||
upper_case_names, partial_cond);
|
||||
mysql_mutex_unlock(&LOCK_show_status);
|
||||
mysql_rwlock_unlock(&LOCK_all_status_vars);
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user