24#ifndef CONNECTION_DELAY_H
25#define CONNECTION_DELAY_H
92 if ((min && new_value > current_max) || (!min && new_value < current_min)) {
116 void *new_value)
override;
143 return std::min((std::max(
count, min_delay)), max_delay);
154 std::vector<opt_connection_control, CustomAllocator<opt_connection_control>>
#define MYSQL_THD
Definition: backup_page_tracker.h:38
Definition: connection_control_memory.h:41
Connection event action to enforce max failed login constraint.
Definition: connection_delay.h:43
ulonglong get_wait_time(int64 count)
Generates wait time.
Definition: connection_delay.h:129
int64 m_threshold
Threshold value which triggers wait.
Definition: connection_delay.h:148
void set_threshold(int64 threshold)
Set threshold value.
Definition: connection_delay.h:65
mysql_rwlock_t * m_lock
RW lock.
Definition: connection_delay.h:161
void make_hash_key(MYSQL_THD thd, Sql_string &s)
Create hash key of the format 'user'@'host'.
Definition: connection_delay.cc:102
void conditional_wait(ulonglong wait_time)
Wait till the wait_time expires or thread is killed.
Definition: connection_delay.cc:159
int64 get_min_delay() const
Get min value.
Definition: connection_delay.h:108
int64 get_threshold() const
Get threshold value.
Definition: connection_delay.h:68
int64 m_max_delay
Upper cap on delay in msec to be generated.
Definition: connection_delay.h:152
bool set_delay(int64 new_value, bool min)
Set min/max delay.
Definition: connection_delay.h:82
void init(Connection_event_coordinator *coordinator)
Subscribe with coordinator for connection events.
Definition: connection_delay.cc:362
void deinit()
Clear data from Connection_delay_action.
Definition: connection_delay.cc:379
int64 get_max_delay() const
Get max value.
Definition: connection_delay.h:105
int64 m_min_delay
Lower cap on delay in msec to be generated.
Definition: connection_delay.h:150
~Connection_delay_action() override
Destructor.
Definition: connection_delay.h:52
bool notify_event(MYSQL_THD thd, Connection_event_coordinator *coordinator, const mysql_event_tracking_connection_data *connection_event) override
Overridden functions.
Definition: connection_delay.cc:226
std::vector< stats_connection_control, CustomAllocator< stats_connection_control > > m_stats_vars
Status variables.
Definition: connection_delay.h:159
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.
Definition: connection_delay.cc:74
bool notify_sys_var(Connection_event_coordinator *coordinator, opt_connection_control variable, void *new_value) override
Notification of a change in system variable value.
Definition: connection_delay.cc:317
std::vector< opt_connection_control, CustomAllocator< opt_connection_control > > m_sys_vars
System variables.
Definition: connection_delay.h:155
Connection event coordinator.
Definition: connection_control_coordinator.h:65
Interface for defining action on connection events.
Definition: connection_control_interfaces.h:42
Definition: connection_control_pfs_table.h:20
opt_connection_control
Enum for system variables : Must be in sync with members of Connection_control_variables.
Definition: connection_control_data.h:35
stats_connection_control
Enum for status variables : Must be in sync with members of Connection_control_statistics.
Definition: connection_control_data.h:46
Common definition used by mysys, performance schema and server & client.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
int64_t int64
Definition: my_inttypes.h:68
static int count
Definition: myisam_ftdump.cc:45
static int wait_time
Definition: mysql.cc:214
SHOW_VAR status_vars[]
Definition: mysqld.cc:11615
Definition: connection_control.h:70
const int64 MIN_DELAY
Definition: connection_delay.cc:43
std::string Sql_string
Definition: connection_control_interfaces.h:34
const int64 MAX_DELAY
Definition: connection_delay.cc:44
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
Plugin service that provides access to the parser and some operations on the parse tree.
Structure for Connection event tracking.
Definition: event_tracking_connection_defs.h:60
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:51