| 1 |
# This test checks if when connection delay occurs the stage event |
| 2 |
# 'stage/conn_delay/Waiting in connection_control plugin' |
| 3 |
# lasts around @@global.connection_control_min_connection_delay, |
| 4 |
# so the user may get proper monitoring data. |
| 5 |
|
| 6 |
# The test will work only in debug mode |
| 7 |
--source include/have_debug.inc |
| 8 |
|
| 9 |
# Make sure that connection_control plugin can be loaded |
| 10 |
--source ../inc/have_connection_control_plugin.inc |
| 11 |
|
| 12 |
--echo # Setup |
| 13 |
--source ../inc/install_connection_control_plugin.inc |
| 14 |
|
| 15 |
# set connection_control variables |
| 16 |
SET @@global.connection_control_failed_connections_threshold = 1; |
| 17 |
SET @@global.connection_control_min_connection_delay = 1230; |
| 18 |
SET @@global.connection_control_max_connection_delay = 1230; |
| 19 |
|
| 20 |
# We don't need to use client side authentication plugin for this test. |
| 21 |
let $USE_AUTH_PLUGIN= 0; |
| 22 |
|
| 23 |
--echo # Not delayed connection |
| 24 |
--replace_result $MASTER_MYSOCK SOURCE_SOCKET $MASTER_MYPORT SOURCE_PORT |
| 25 |
--error ER_ACCESS_DENIED_ERROR |
| 26 |
connect(fail_con, localhost, u,,,,,); |
| 27 |
|
| 28 |
--echo # Delayed connection |
| 29 |
--replace_result $MASTER_MYSOCK SOURCE_SOCKET $MASTER_MYPORT SOURCE_PORT |
| 30 |
--error ER_ACCESS_DENIED_ERROR |
| 31 |
connect(fail_con, localhost, u,,,,,); |
| 32 |
|
| 33 |
--echo # The stage event should be in the history, the timer wait must be slightly bigger |
| 34 |
--echo # than configured connection delay, assume not more than 1/10 sec is good approximation, |
| 35 |
--echo # so the below must be 0 |
| 36 |
SELECT FLOOR((TIMER_WAIT/100000000000 - @@connection_control_min_connection_delay/100)) from performance_schema.events_stages_history_long WHERE EVENT_NAME LIKE 'stage/conn_delay/Waiting in connection_control plugin'; |
| 37 |
|
| 38 |
--echo # Cleanup |
| 39 |
--echo # Uninstall connection_control plugin |
| 40 |
--source ../inc/uninstall_connection_control_plugin.inc |