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

@ -25,7 +25,7 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection default;
flush status;
flush global status;
show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
@ -121,7 +121,7 @@ drop table t1;
let $disconnect_timeout = 10;
# Wait for any previous disconnects to finish.
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--disable_query_log
--disable_result_log
eval SET @wait_left = $disconnect_timeout;
@ -131,7 +131,7 @@ let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
while ($wait_more)
{
sleep 1;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET @wait_left = @wait_left - 1;
let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
@ -160,7 +160,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_us
# Check that after flush max_used_connections equals to current number
# of connections. First wait for previous disconnect to finish.
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--disable_query_log
--disable_result_log
eval SET @wait_left = $disconnect_timeout;
@ -170,7 +170,7 @@ let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
while ($wait_more)
{
sleep 1;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET @wait_left = @wait_left - 1;
let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
@ -446,7 +446,7 @@ SET GLOBAL log_output = @old_log_output;
--echo # MDEV-30543 New status variable: Max_used_connections_time
--echo #
FLUSH STATUS;
FLUSH GLOBAL STATUS;
connect (con1,localhost,root,,);
--sleep 1
@ -472,4 +472,42 @@ eval SELECT '$time_1' < '$time_3' as expect_1;
disconnect con4;
disconnect con3;
disconnect con1;
connection default;
--echo # Test Uptime_since_flush_status
--echo # All results below should be 1
flush global status;
flush session status;
--sleep 1
let $global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--sleep 2
--disable_query_log
--eval select $global_flush_status >= $local_flush_status as "1"
flush session status;
let $new_global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $new_local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--eval select $new_global_flush_status >= $global_flush_status as "1"
--eval select $new_local_flush_status < $global_flush_status as "1"
--sleep 2
flush global status;
let $local_flush_status=$new_local_flush_status;
let $new_global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $new_local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--eval select $new_local_flush_status >= $local_flush_status as "1"
--eval select $new_global_flush_status < $new_local_flush_status as "1"
--enable_query_log
--echo #
--echo # end of 11.5 tests
--echo #