Commit 5a049ba8 authored by msvensson@shellback.(none)'s avatar msvensson@shellback.(none)

Merge shellback.(none):/home/msvensson/mysql/mysql-5.0-maint

into  shellback.(none):/home/msvensson/mysql/mysql-5.1-maint
parents f11aa15c e8c7f191
...@@ -149,7 +149,8 @@ DROP TABLE t1, t2; ...@@ -149,7 +149,8 @@ DROP TABLE t1, t2;
# #
# Bug #22728 - Handler_rollback value is growing # Bug #22728 - Handler_rollback value is growing
# #
flush status;
let $before= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
create table t1 (c1 int) engine=innodb; create table t1 (c1 int) engine=innodb;
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
...@@ -158,7 +159,11 @@ handler t1 open; ...@@ -158,7 +159,11 @@ handler t1 open;
handler t1 read first; handler t1 read first;
disconnect con2; disconnect con2;
connection con1; connection con1;
show /*!50002 GLOBAL */ status like 'Handler_rollback'; let $after= `show /*!50002 GLOBAL */ status like 'Handler_rollback'`;
# Compare the before and after value, it should be equal
--disable_query_log
eval select STRCMP("$before", "$after") as "Before and after comparison";
--enable_query_log
connection default; connection default;
drop table t1; drop table t1;
disconnect con1; disconnect con1;
......
...@@ -105,14 +105,12 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = ...@@ -105,14 +105,12 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` =
id1 id1
2 2
DROP TABLE t1, t2; DROP TABLE t1, t2;
flush status;
create table t1 (c1 int) engine=innodb; create table t1 (c1 int) engine=innodb;
handler t1 open; handler t1 open;
handler t1 read first; handler t1 read first;
c1 c1
show /*!50002 GLOBAL */ status like 'Handler_rollback'; Before and after comparison
Variable_name Value 0
Handler_rollback 0
drop table t1; drop table t1;
End of 4.1 tests End of 4.1 tests
create table t1m (a int) engine = MEMORY; create table t1m (a int) engine = MEMORY;
......
...@@ -6581,6 +6581,10 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6581,6 +6581,10 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff)
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
/*
Variables shown by SHOW STATUS in alphabetical order
*/
SHOW_VAR status_vars[]= { SHOW_VAR status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG}, {"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, {"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
...@@ -8088,16 +8092,20 @@ void refresh_status(THD *thd) ...@@ -8088,16 +8092,20 @@ 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 thread's status variabes to global status */
add_to_status(&global_status_var, &thd->status_var); add_to_status(&global_status_var, &thd->status_var);
/* Reset thread's status variables */
bzero((char*) &thd->status_var, sizeof(thd->status_var)); bzero((char*) &thd->status_var, sizeof(thd->status_var));
/* Reset some global variables */
for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++) for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++)
{ {
/* Note that SHOW_LONG_NOFLUSH variables are not reset */ /* Note that SHOW_LONG_NOFLUSH variables are not reset */
if (ptr->type == SHOW_LONG) if (ptr->type == SHOW_LONG)
*(ulong*) ptr->value= 0; *(ulong*) ptr->value= 0;
} }
/* 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);
pthread_mutex_unlock(&LOCK_status); pthread_mutex_unlock(&LOCK_status);
......
...@@ -743,7 +743,7 @@ static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff) ...@@ -743,7 +743,7 @@ static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
/* /*
Variables shown by SHOW variables in alphabetical order Variables shown by SHOW VARIABLES in alphabetical order
*/ */
SHOW_VAR init_vars[]= { SHOW_VAR init_vars[]= {
......
...@@ -513,14 +513,13 @@ THD::~THD() ...@@ -513,14 +513,13 @@ THD::~THD()
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
{ {
ulong *end= (ulong*) ((byte*) to_var + offsetof(STATUS_VAR, ulong *end= (ulong*) ((byte*) to_var +
last_system_status_var) + offsetof(STATUS_VAR, last_system_status_var) +
sizeof(ulong)); sizeof(ulong));
ulong *to= (ulong*) to_var, *from= (ulong*) from_var; ulong *to= (ulong*) to_var, *from= (ulong*) from_var;
while (to != end) while (to != end)
*(to++)+= *(from++); *(to++)+= *(from++);
/* it doesn't make sense to add last_query_cost values */
} }
/* /*
......
...@@ -337,12 +337,17 @@ typedef struct system_status_var ...@@ -337,12 +337,17 @@ typedef struct system_status_var
ulong com_stmt_reset; ulong com_stmt_reset;
ulong com_stmt_close; ulong com_stmt_close;
/*
Status variables which it does not make sense to add to
global status variable counter
*/
double last_query_cost; double last_query_cost;
} STATUS_VAR; } STATUS_VAR;
/* /*
This is used for 'show status'. It must be updated to the last ulong This is used for 'SHOW STATUS'. It must be updated to the last ulong
variable in system_status_var variable in system_status_var which is makes sens to add to the global
counter
*/ */
#define last_system_status_var com_stmt_close #define last_system_status_var com_stmt_close
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment