mariadb/mysql-test/main/aborted_clients.test
Sergey Vojtovich 49f351f583 MDEV-36835 - main.aborted_clients fails after various tests
Some tests like main.ssl_timeout and main.wait_timeout may abort
connections. If main.aborted_clients follows such tests it may
observe unstable value of aborted_clients status variable.

FLUSH STATUS was issued to make aborted_clients value reproducible.
However after 775cba4d0f FLUSH STATUS doesn't reset global status.

Fixed by using FLUSH GLOBAL STATUS.

Regression after "MDEV-33145 - Add FLUSH GLOBAL STATUS".
2025-05-24 22:20:44 +04:00

28 lines
967 B
Text

# Test case for MDEV-246, lp:992983
# Check that ordinary connect/disconnect does not increase aborted_clients
# status variable, but KILL connection does
-- source include/not_embedded.inc
-- source include/count_sessions.inc
FLUSH GLOBAL STATUS;
# Connect/Disconnect look that aborted_clients stays 0
connect (con1,localhost,root,,);
disconnect con1;
connection default;
-- source include/wait_until_count_sessions.inc
# Check that there is 0 aborted clients so far
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
# Kill a connection, check that aborted_clients is incremented
connect(con2,localhost,root,,);
--disable_reconnect
--error ER_CONNECTION_KILLED
KILL CONNECTION_ID();
disconnect con2;
connection default;
-- source include/wait_until_count_sessions.inc
# aborted clients must be 1 now
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
FLUSH STATUS;