mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed refresh_status function.
This commit is contained in:
@ -445,7 +445,12 @@ THD::~THD()
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add to one status variable another status variable
|
Add all status variables to another status variable array
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
add_to_status()
|
||||||
|
to_var add to this array
|
||||||
|
from_var from this array
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
This function assumes that all variables are long/ulong.
|
This function assumes that all variables are long/ulong.
|
||||||
|
@ -6538,7 +6538,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
|||||||
if (options & REFRESH_HOSTS)
|
if (options & REFRESH_HOSTS)
|
||||||
hostname_cache_refresh();
|
hostname_cache_refresh();
|
||||||
if (thd && (options & REFRESH_STATUS))
|
if (thd && (options & REFRESH_STATUS))
|
||||||
refresh_status();
|
refresh_status(thd);
|
||||||
if (options & REFRESH_THREADS)
|
if (options & REFRESH_THREADS)
|
||||||
flush_thread_cache();
|
flush_thread_cache();
|
||||||
#ifdef HAVE_REPLICATION
|
#ifdef HAVE_REPLICATION
|
||||||
@ -6624,20 +6624,18 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
|||||||
|
|
||||||
/* Clear most status variables */
|
/* Clear most status variables */
|
||||||
|
|
||||||
static void refresh_status(void)
|
static void refresh_status(THD *thd)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_status);
|
pthread_mutex_lock(&LOCK_status);
|
||||||
|
|
||||||
|
/* We must update the global status before cleaning up the thread */
|
||||||
|
add_to_status(&global_status_var, &thd->status_var);
|
||||||
|
bzero((char*) &thd->status_var, sizeof(thd->status_var));
|
||||||
|
|
||||||
for (struct show_var_st *ptr=status_vars; ptr->name; ptr++)
|
for (struct show_var_st *ptr=status_vars; ptr->name; ptr++)
|
||||||
{
|
{
|
||||||
if (ptr->type == SHOW_LONG)
|
if (ptr->type == SHOW_LONG)
|
||||||
*(ulong*) ptr->value= 0;
|
*(ulong*) ptr->value= 0;
|
||||||
else if (ptr->type == SHOW_LONG_STATUS)
|
|
||||||
{
|
|
||||||
THD *thd= current_thd;
|
|
||||||
/* We must update the global status before cleaning up the thread */
|
|
||||||
add_to_status(&global_status_var, &thd->status_var);
|
|
||||||
bzero((char*) &thd->status_var, sizeof(thd->status_var));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Reset the counters of all key caches (default and named). */
|
/* Reset the counters of all key caches (default and named). */
|
||||||
process_key_caches(reset_key_cache_counters);
|
process_key_caches(reset_key_cache_counters);
|
||||||
|
Reference in New Issue
Block a user