| 1 |
# Setup |
| 2 |
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB'; |
| 3 |
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB'; |
| 4 |
SET @@global.connection_control_failed_connections_threshold = 1; |
| 5 |
SET @@global.connection_control_min_connection_delay = 1230; |
| 6 |
SET @@global.connection_control_max_connection_delay = 1230; |
| 7 |
# Not delayed connection |
| 8 |
connect(localhost,u,,test,SOURCE_PORT,SOURCE_SOCKET); |
| 9 |
ERROR 28000: Access denied for user 'u'@'localhost' (using password: NO) |
| 10 |
# Delayed connection |
| 11 |
connect(localhost,u,,test,SOURCE_PORT,SOURCE_SOCKET); |
| 12 |
ERROR 28000: Access denied for user 'u'@'localhost' (using password: NO) |
| 13 |
# The stage event should be in the history, the timer wait must be slightly bigger |
| 14 |
# than configured connection delay, assume not more than 1/10 sec is good approximation, |
| 15 |
# so the below must be 0 |
| 16 |
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'; |
| 17 |
FLOOR((TIMER_WAIT/100000000000 - @@connection_control_min_connection_delay/100)) |
| 18 |
0 |
| 19 |
# Cleanup |
| 20 |
# Uninstall connection_control plugin |
| 21 |
UNINSTALL PLUGIN connection_control; |
| 22 |
UNINSTALL PLUGIN connection_control_failed_login_attempts; |