diff options
author | unknown <jani@ua141d10.elisa.omakaista.fi> | 2006-01-10 18:56:23 +0200 |
---|---|---|
committer | unknown <jani@ua141d10.elisa.omakaista.fi> | 2006-01-10 18:56:23 +0200 |
commit | 55499cad0dc7403832b45ac072359cc2a62aa890 (patch) | |
tree | ff61fbb42dec6a32c8814329311348e18dd9f362 | |
parent | 935ad7e8f376805f435d6e105d337efb54a31379 (diff) | |
download | mariadb-git-55499cad0dc7403832b45ac072359cc2a62aa890.tar.gz |
Fixed refresh_status function.
sql/sql_class.cc:
Improved documentation on add_to_status().
sql/sql_parse.cc:
Changed refresh status to take thd as argument to avoid current_thd.
Removed add_to_status away from loop, as it is not necessary for each
variable, only required for each thread. In this case only the current
thread.
-rw-r--r-- | sql/sql_class.cc | 7 | ||||
-rw-r--r-- | sql/sql_parse.cc | 16 |
2 files changed, 13 insertions, 10 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ed2089546da..ca86c077a3a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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 This function assumes that all variables are long/ulong. diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9cdb288c045..e322fd466d3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6538,7 +6538,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, if (options & REFRESH_HOSTS) hostname_cache_refresh(); if (thd && (options & REFRESH_STATUS)) - refresh_status(); + refresh_status(thd); if (options & REFRESH_THREADS) flush_thread_cache(); #ifdef HAVE_REPLICATION @@ -6624,20 +6624,18 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query) /* Clear most status variables */ -static void refresh_status(void) +static void refresh_status(THD *thd) { 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++) { if (ptr->type == SHOW_LONG) *(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). */ process_key_caches(reset_key_cache_counters); |