1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

[MDEV-30543] New status variable: max_used_connections_time

Add variable max_used_connections_time to show the time at which
max_used_connections reached its current value. This is useful for
troubleshooting high connection counts. MySQL 8 has this already.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the BSD-new
license. I am contributing on behalf of my employer Amazon Web Services.
This commit is contained in:
Mikhail Chalov
2023-03-02 16:14:33 -08:00
committed by Daniel Black
parent c4d6d6fd81
commit ada3987948
3 changed files with 69 additions and 1 deletions

View File

@ -447,3 +447,34 @@ SET GLOBAL log_output = @old_log_output;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
--echo #
--echo # MDEV-30543 New status variable: Max_used_connections_time
--echo #
FLUSH STATUS;
connect (con1,localhost,root,,);
--sleep 1
connect (con2,localhost,root,,);
--sleep 1
let $time_1=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
--sleep 1
connection con1;
disconnect con2;
--sleep 1
let $time_2=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
--replace_regex /[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*/DTVALUE/
eval SELECT '$time_1' = '$time_2' AS expect_1;
--sleep 1
connect (con3,localhost,root,,);
--sleep 1
connect (con4,localhost,root,,);
--sleep 1
let $time_3=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
--replace_regex /[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*/DTVALUE/
eval SELECT '$time_1' < '$time_3' as expect_1;
disconnect con4;
disconnect con3;
disconnect con1;