1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-33145 Add FLUSH GLOBAL STATUS

- FLUSH GLOBAL STATUS now resets most global_status_vars.
  At this stage, this is mainly to be used for testing.
- FLUSH SESSION STATUS added as an alias for FLUSH STATUS.
- FLUSH STATUS does not require any privilege (before required RELOAD).
- FLUSH GLOBAL STATUS requires RELOAD privilege.
- All global status reset moved to FLUSH GLOBAL STATUS.
- Replication semisync status variables are now reset by
  FLUSH GLOBAL STATUS.
- In test cases, the only changes are:
  - Replace FLUSH STATUS with FLUSH GLOBAL STATUS
  - Replace FLUSH STATUS with FLUSH STATUS; FLUSH GLOBAL STATUS.
    This was only done in a few tests where the test was using SHOW STATUS
    for both local and global variables.
- Uptime_since_flush_status is now always provided, independent if
  ENABLED_PROFILING is enabled when compiling MariaDB.
- @@global.Uptime_since_flush_status is reset on FLUSH GLOBAL STATUS
  and @@session.Uptime_since_flush_status is reset on FLUSH SESSION STATUS.
- When connected, @@session.Uptime_since_flush_status is set to 0.
This commit is contained in:
Monty
2023-12-31 16:23:04 +02:00
committed by Sergei Golubchik
parent d2b39a2c82
commit 775cba4d0f
325 changed files with 787 additions and 525 deletions

View File

@ -87,7 +87,7 @@ reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
let $1=100;

View File

@ -25,7 +25,7 @@ set @@global.binlog_cache_size=32768;
--echo **** Preparing the enviroment to check commit and its effect on status variables.
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
let $exp_cache= 0;
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1);
let $exp_disk= 0;
@ -142,7 +142,7 @@ if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cach
--echo **** Preparing the enviroment to check abort and its effect on the status variables.
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
let $exp_cache= 0;
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1);
let $exp_disk= 0;

View File

@ -55,7 +55,7 @@ INSERT INTO t1 VALUES (303);
SET @gtid_pos= @@GLOBAL.gtid_binlog_pos;
INSERT INTO t1 VALUES (304);
INSERT INTO t1 VALUES (305);
FLUSH NO_WRITE_TO_BINLOG STATUS;
FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
+++ Initial status:
SHOW STATUS LIKE 'binlog_gtid_index_%';
Variable_name Value

View File

@ -121,7 +121,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE t1;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -373,7 +373,7 @@ set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
@ -385,7 +385,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int, b char(255)) engine=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; flush status
master-bin.000001 # Query # # use `test`; flush global status
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 values( 100, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
master-bin.000001 # Table_map # # table_id: # (test.t1)

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -176,7 +176,7 @@ set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
@ -188,7 +188,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int, b char(255)) engine=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; flush status
master-bin.000001 # Query # # use `test`; flush global status
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values( 100, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
master-bin.000001 # Query # # use `test`; insert into t1 values( 99, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -4,9 +4,9 @@ reset master;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # flush status
master-bin.000001 # Query # # flush /*!110500 global */ status
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # flush status
master-bin.000001 # Query # # flush /*!110500 global */ status
drop user adm@localhost;

View File

@ -87,7 +87,7 @@ INSERT INTO t1 VALUES (305);
# BINLOG_GTID_POS() has a side effect: it increments binlog_gtid_index_hit
--disable_ps2_protocol
FLUSH NO_WRITE_TO_BINLOG STATUS;
FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
--echo +++ Initial status:
SHOW STATUS LIKE 'binlog_gtid_index_%';
--echo +++ GTID Lookup in good index.

View File

@ -101,7 +101,7 @@ DROP TABLE t1;
# Actually this test has nothing to do with innodb per se, it just requires
# transactional table.
#
flush status;
flush global status;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";