mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
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
This commit is contained in:
parent
ac54f00f00
commit
e8c7f19179
6 changed files with 28 additions and 13 deletions
|
@ -104,14 +104,12 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` =
|
|||
id1
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
flush status;
|
||||
create table t1 (c1 int) engine=innodb;
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
c1
|
||||
show /*!50002 GLOBAL */ status like 'Handler_rollback';
|
||||
Variable_name Value
|
||||
Handler_rollback 0
|
||||
Before and after comparison
|
||||
0
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1m (a int) engine=myisam;
|
||||
|
|
|
@ -119,7 +119,8 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` =
|
|||
DROP TABLE t1, t2;
|
||||
# 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;
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
@ -128,7 +129,11 @@ handler t1 open;
|
|||
handler t1 read first;
|
||||
disconnect con2;
|
||||
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;
|
||||
drop table t1;
|
||||
disconnect con1;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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[]= {
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue