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

@ -17,7 +17,7 @@ update performance_schema.threads SET instrumented = 'YES'
# reset lost counters
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
--disable_warnings
DROP TABLE IF EXISTS t1;

View File

@ -15,7 +15,7 @@ WHERE name LIKE 'wait/synch/mutex/%'
# reset lost counters
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
# Make sure objects are instrumented
select NAME from performance_schema.mutex_instances

View File

@ -45,6 +45,6 @@ show global status like "connection_errors_%";
SET @@GLOBAL.debug_dbug = @saved_dbug;
flush status;
flush global status;
show global status like "connection_errors_%";

View File

@ -109,7 +109,7 @@ prepare dump_waits_history_long from
# reset lost counters
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
flush tables;

View File

@ -24,7 +24,7 @@ CREATE TABLE test.t_range(a int, b int, PRIMARY KEY(a));
INSERT INTO test.t_range values (1, 1), (2,2), (3, 3), (4, 4), (5, 5);
INSERT INTO test.t_range values (6, 6), (7,7), (8, 8), (9, 9), (10, 10);
FLUSH STATUS;
FLUSH GLOBAL STATUS;
let $initial= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'`;

View File

@ -16,7 +16,7 @@ truncate table performance_schema.events_waits_history_long;
# Reset lost counters to a known state
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
# Code to test

View File

@ -60,7 +60,7 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES'
# Start from a known clean state, to avoid noise from previous tests
truncate table performance_schema.events_statements_summary_by_digest;
flush tables;
flush status;
flush global status;
truncate performance_schema.events_waits_current;
truncate performance_schema.events_waits_history;

View File

@ -12,7 +12,7 @@ drop procedure if exists check_instrument;
# reset counters
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
# Print known global memory instruments (PSI_FLAG_GLOBAL),
# see maintenance of count_global_expected below.

View File

@ -20,7 +20,7 @@ SET GLOBAL query_cache_size=1355776;
flush query cache;
reset query cache;
flush status;
flush global status;
--disable_ps2_protocol
select * from t1;
@ -57,5 +57,5 @@ show global status like "Qcache_hits";
SET GLOBAL query_cache_size=@save_query_cache_size;
drop table t1;
flush status;
flush global status;

View File

@ -25,7 +25,7 @@ SET @@session.sql_log_bin=OFF;
connection default;
USE test;
flush status;
flush global status;
--echo #
--echo # Create results table
@ -277,10 +277,10 @@ FROM test.status_results
ORDER BY variable_name;
--echo # ================================================================================
--echo # TEST 8: FLUSH STATUS should clear account, host and user status
--echo # TEST 8: FLUSH GLOBAL STATUS should clear account, host and user status
--echo # ================================================================================
--echo #
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--echo #
SELECT * FROM status_by_account WHERE user IN ('user1', 'user2', 'user3') AND variable_name IN ('handler_delete');
--echo #

View File

@ -93,7 +93,7 @@ SELECT variable_value FROM status_by_thread
WHERE variable_name = "bytes_received" and thread_id = @thread_id INTO @bytes_before;
--echo #
--echo # Reset status counters
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--echo #
--echo # Record bytes_received after reset
SELECT variable_value FROM status_by_thread
@ -170,7 +170,7 @@ SET long_query_time = @@global.long_query_time;
--source include/assert.inc
--echo #
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--echo #
## Global value requested from the default session after FLUSH must remain the same

View File

@ -8,6 +8,7 @@ select 2;
SHOW STATUS LIKE 'Last_query_cost';
flush status;
flush global status;
SHOW STATUS LIKE 'Created_tmp_tables';
--echo #

View File

@ -67,7 +67,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
# While at it, check that FLUSH STATUS Resets the lost counter
FLUSH STATUS;
FLUSH GLOBAL STATUS;
select variable_value from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
@ -124,7 +124,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
--enable_warnings
FLUSH STATUS;
FLUSH GLOBAL STATUS;
#####################################################################################

View File

@ -86,8 +86,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
--enable_warnings
flush status;
flush global status;
#######################################
# Update setup_objects to DISABLE TABLE

View File

@ -53,8 +53,8 @@ select COUNT_STAR from performance_schema.table_io_waits_summary_by_index_usage
select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
# While at it, check that FLUSH STATUS Resets the lost counter
FLUSH STATUS;
# While at it, check that FLUSH GLOBAL STATUS Resets the lost counter
FLUSH GLOBAL STATUS;
select variable_value from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';

View File

@ -14,7 +14,7 @@ select variable_value > 0 from information_schema.global_status
--enable_warnings
# While at it, check that flush status resets the lost counter
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--disable_warnings
select variable_value from information_schema.global_status

View File

@ -35,7 +35,7 @@ show global status like "%performance_schema_prepared_statements_lost%";
show global status like "%performance_schema_prepared_statements_lost%";
# Flush status now
flush status;
flush global status;
# status after flush. expect 0.
show global status like "%performance_schema_prepared_statements_lost%";

View File

@ -44,7 +44,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
# While at it, check that FLUSH STATUS Resets the lost counter
FLUSH STATUS;
FLUSH GLOBAL STATUS;
select variable_value from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';

View File

@ -11,7 +11,7 @@
# Setup
flush status;
flush global status;
SET @saved_thread_cache_size = @@global.thread_cache_size;