1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#15933: max_used_connections is wrong after FLUSH STATUS if connections are cached

After FLUSH STATUS max_used_connections was reset to 0, and haven't
been updated while cached threads were reused, until the moment a new
thread was created.

The first suggested fix from original bug report was implemented:

  a) On flushing the status, set max_used_connections to
  threads_connected, not to 0.

  b) Check if it is necessary to increment max_used_connections when
  taking a thread from the cache as well as when creating new threads
This commit is contained in:
kroki@mysql.com
2006-04-07 15:30:40 +04:00
parent a1bf113868
commit 6222ca41a5
5 changed files with 142 additions and 39 deletions

View File

@ -74,7 +74,6 @@ static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
static bool check_multi_update_lock(THD *thd);
static void remove_escape(char *name);
static void refresh_status(THD *thd);
static bool append_file_to_dir(THD *thd, const char **filename_ptr,
const char *table_name);
@ -6709,27 +6708,6 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
}
/* Clear most status variables */
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;
}
/* Reset the counters of all key caches (default and named). */
process_key_caches(reset_key_cache_counters);
pthread_mutex_unlock(&LOCK_status);
}
/* If pointer is not a null pointer, append filename to it */
static bool append_file_to_dir(THD *thd, const char **filename_ptr,