![]() |
MySQL 9.3.0
Source Code Documentation
|
Connection event action to enforce max failed login constraint. More...
#include <connection_delay.h>
Public Member Functions | |
Connection_delay_action (int64 threshold, int64 min_delay, int64 max_delay, opt_connection_control *sys_vars, size_t sys_vars_size, stats_connection_control *status_vars, size_t status_vars_size, mysql_rwlock_t *lock) | |
Connection_delay_action Constructor. More... | |
~Connection_delay_action () override | |
Destructor. More... | |
void | init (Connection_event_coordinator *coordinator) |
Subscribe with coordinator for connection events. More... | |
void | set_threshold (int64 threshold) |
Set threshold value. More... | |
int64 | get_threshold () const |
Get threshold value. More... | |
bool | set_delay (int64 new_value, bool min) |
Set min/max delay. More... | |
int64 | get_max_delay () const |
Get max value. More... | |
int64 | get_min_delay () const |
Get min value. More... | |
bool | notify_event (MYSQL_THD thd, Connection_event_coordinator *coordinator, const mysql_event_tracking_connection_data *connection_event) override |
Overridden functions. More... | |
bool | notify_sys_var (Connection_event_coordinator *coordinator, opt_connection_control variable, void *new_value) override |
Notification of a change in system variable value. More... | |
![]() | |
virtual | ~Connection_event_observer ()=default |
Private Member Functions | |
void | deinit () |
Clear data from Connection_delay_action. More... | |
void | make_hash_key (MYSQL_THD thd, Sql_string &s) |
Create hash key of the format 'user'@'host'. More... | |
ulonglong | get_wait_time (int64 count) |
Generates wait time. More... | |
void | conditional_wait (ulonglong wait_time) |
Wait till the wait_time expires or thread is killed. More... | |
Private Attributes | |
int64 | m_threshold |
Threshold value which triggers wait. More... | |
int64 | m_min_delay |
Lower cap on delay in msec to be generated. More... | |
int64 | m_max_delay |
Upper cap on delay in msec to be generated. More... | |
std::vector< opt_connection_control, CustomAllocator< opt_connection_control > > | m_sys_vars |
System variables. More... | |
std::vector< stats_connection_control, CustomAllocator< stats_connection_control > > | m_stats_vars |
Status variables. More... | |
mysql_rwlock_t * | m_lock |
RW lock. More... | |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t size) noexcept |
static void * | operator new[] (size_t size) noexcept |
static void | operator delete (void *ptr) |
static void | operator delete[] (void *ptr) |
Connection event action to enforce max failed login constraint.
connection_control::Connection_delay_action::Connection_delay_action | ( | int64 | threshold, |
int64 | min_delay, | ||
int64 | max_delay, | ||
opt_connection_control * | sys_vars, | ||
size_t | sys_vars_size, | ||
stats_connection_control * | status_vars, | ||
size_t | status_vars_size, | ||
mysql_rwlock_t * | lock | ||
) |
Connection_delay_action Constructor.
[in] | threshold | Defines a threshold after which wait is triggered |
[in] | min_delay | Lower cap on wait |
[in] | max_delay | Upper cap on wait |
[in] | sys_vars | System variables |
[in] | sys_vars_size | Size of sys_vars array |
[in] | status_vars | Status variables |
[in] | status_vars_size | Size of status_vars array |
[in] | lock | RW lock handle |
|
inlineoverride |
Destructor.
|
private |
Wait till the wait_time expires or thread is killed.
[in] | wait_time | Maximum time to wait in msec |
mysql_cond_timedwait requires wait time in timespec format
Initialize mutex required for mysql_cond_timedwait
Register wait condition with THD
|
private |
Clear data from Connection_delay_action.
|
inline |
Get max value.
|
inline |
Get min value.
|
inline |
Get threshold value.
Generates wait time.
count | [in] Proposed delay in msec |
void connection_control::Connection_delay_action::init | ( | Connection_event_coordinator * | coordinator | ) |
Subscribe with coordinator for connection events.
[in] | coordinator | Handle to Connection_event_coordinator for registration |
|
private |
Create hash key of the format 'user'@'host'.
Policy:
[in] | thd | THD pointer for getting security context |
[out] | s | Hash key is stored here |
|
overridevirtual |
Overridden functions.
Handle a connection event and, if required, wait for random amount of time before returning.
We only care about CONNECT and CHANGE_USER sub events.
[in] | thd | THD pointer |
[in] | coordinator | Connection_event_coordinator |
[in] | connection_event | Connection event to be handled |
false | Successfully handled an event. |
true | Something went wrong. error_buffer may contain details. |
Implements connection_control::Connection_event_observer.
|
overridevirtual |
Notification of a change in system variable value.
[in] | coordinator | Handle to coordinator |
[in] | variable | Enum of variable |
[in] | new_value | New value for variable |
false | Change in variable value processed successfully |
true | Error processing new value. error_buffer may contain more details. |
Implements connection_control::Connection_event_observer.
|
inline |
Set min/max delay.
new_value | [in] New m_min_delay/m_max_delay value |
min | [in] true for m_min_delay. false otherwise. |
false | Success |
true | Failure. Invalid value specified. |
|
inline |
Set threshold value.
threshold | [in] New threshold value |
|
private |
RW lock.
|
private |
Upper cap on delay in msec to be generated.
|
private |
Lower cap on delay in msec to be generated.
|
private |
Status variables.
|
private |
System variables.
|
private |
Threshold value which triggers wait.