summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <msvensson@shellback.(none)>2006-10-30 13:35:57 +0100
committerunknown <msvensson@shellback.(none)>2006-10-30 13:35:57 +0100
commite948c64ff52fda43d2a7cb59bc631e53051adc05 (patch)
treeed018f6cd021c72d6546b20cee0afd2ed705b360 /sql
parent3e7cae68afbe87b9a7376b2e8b2edbdf952c4a72 (diff)
downloadmariadb-git-e948c64ff52fda43d2a7cb59bc631e53051adc05.tar.gz
Improve comments around FLUSH STATUS
It's not possible to flush the global status variables in 5.0 Update test case so it works by recording the value of handle_rollback before and compare it to the value after mysql-test/r/innodb_mysql.result: Update result file mysql-test/t/innodb_mysql.test: It's not possible to reset the global status variables in 5.0 so intead its value is recorded and compared to the after value. It should not have changed. sql/mysqld.cc: Improve comments sql/set_var.cc: Improve comments sql/sql_class.cc: Improve comments sql/sql_class.h: Improve comments
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sql_class.cc5
-rw-r--r--sql/sql_class.h9
4 files changed, 19 insertions, 7 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1dd15398cd1..c84e1f7ee56 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5997,6 +5997,10 @@ The minimum value for this variable is 4096.",
};
+/*
+ Variables shown by SHOW STATUS in alphabetical order
+*/
+
struct show_var_st status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
@@ -7466,15 +7470,19 @@ void refresh_status(THD *thd)
{
pthread_mutex_lock(&LOCK_status);
- /* We must update the global status before cleaning up the thread */
+ /* Add thread's status variabes to global status */
add_to_status(&global_status_var, &thd->status_var);
+
+ /* Reset thread's status variables */
bzero((char*) &thd->status_var, sizeof(thd->status_var));
+ /* Reset some global variables */
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);
diff --git a/sql/set_var.cc b/sql/set_var.cc
index df0c69260e7..55c62a9a5a5 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -804,7 +804,7 @@ sys_var *sys_variables[]=
/*
- Variables shown by SHOW variables in alphabetical order
+ Variables shown by SHOW VARIABLES in alphabetical order
*/
struct show_var_st init_vars[]= {
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index f5bab1d17f4..ba2f525a4a4 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -464,14 +464,13 @@ THD::~THD()
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
{
- ulong *end= (ulong*) ((byte*) to_var + offsetof(STATUS_VAR,
- last_system_status_var) +
+ ulong *end= (ulong*) ((byte*) to_var +
+ offsetof(STATUS_VAR, last_system_status_var) +
sizeof(ulong));
ulong *to= (ulong*) to_var, *from= (ulong*) from_var;
while (to != end)
*(to++)+= *(from++);
- /* it doesn't make sense to add last_query_cost values */
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 62cfb0119aa..c7bdfbd7ea7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -646,12 +646,17 @@ typedef struct system_status_var
ulong com_stmt_reset;
ulong com_stmt_close;
+ /*
+ Status variables which it does not make sense to add to
+ global status variable counter
+ */
double last_query_cost;
} STATUS_VAR;
/*
- This is used for 'show status'. It must be updated to the last ulong
- variable in system_status_var
+ This is used for 'SHOW STATUS'. It must be updated to the last ulong
+ variable in system_status_var which is makes sens to add to the global
+ counter
*/
#define last_system_status_var com_stmt_close