MySQL 8.0.29
Source Code Documentation
Thd_mem_cnt_conn Class Reference

#include <sql_class.h>

Inheritance diagram for Thd_mem_cnt_conn:
[legend]

Public Member Functions

 Thd_mem_cnt_conn (THD *thd_arg)
 
 ~Thd_mem_cnt_conn () override
 
bool alloc_cnt (size_t size) override
 Increase memory counter at 'alloc' operation. More...
 
void free_cnt (size_t size) override
 Decrease memory counter at 'free' operation. More...
 
int reset () override
 Funtion resets current memory counter mode and adjust global memory counter according to thread memory counter. More...
 
void flush () override
 Function flushes memory counters before deleting the memory counter object. More...
 
void restore_mode () override
 Restore original memory counter mode. More...
 
void no_error_mode () override
 Set NO ERROR memory counter mode. More...
 
void set_curr_mode (uint mode_arg) override
 Function sets current memory counter mode. More...
 
void set_orig_mode (uint mode_arg) override
 Function sets original memory counter mode. More...
 
bool is_error () override
 Check if memory counter error is issued. More...
 
void set_thd_error_status () override
 Set THD error status using memory counter diagnostics area. More...
 
- Public Member Functions inherited from Thd_mem_cnt
 Thd_mem_cnt ()=default
 
virtual ~Thd_mem_cnt ()=default
 

Private Member Functions

int generate_error (int err_no, ulonglong mem_limit, ulonglong mem_size)
 Generate OOM error and set therad to KILL_CONNECTION state. More...
 
bool is_error_mode () const
 Check if memory counter is in error mode. More...
 
bool is_error_log_mode () const
 Check if memory counter is in error log mode. More...
 

Private Attributes

THDm_thd
 
Diagnostics_area m_da {false}
 
ulonglong mem_counter {0}
 
ulonglong max_conn_mem {0}
 
ulonglong glob_mem_counter {0}
 
uint curr_mode {MEM_CNT_DEFAULT}
 
uint orig_mode {MEM_CNT_DEFAULT}
 
bool is_connection_stage {true}
 

Constructor & Destructor Documentation

◆ Thd_mem_cnt_conn()

Thd_mem_cnt_conn::Thd_mem_cnt_conn ( THD thd_arg)
inline

◆ ~Thd_mem_cnt_conn()

Thd_mem_cnt_conn::~Thd_mem_cnt_conn ( )
inlineoverride

Member Function Documentation

◆ alloc_cnt()

bool Thd_mem_cnt_conn::alloc_cnt ( size_t  size)
overridevirtual

Increase memory counter at 'alloc' operation.

Update global memory counter.

Parameters
sizeamount of memory allocated.
Returns
always true

Implements Thd_mem_cnt.

◆ flush()

void Thd_mem_cnt_conn::flush ( )
overridevirtual

Function flushes memory counters before deleting the memory counter object.

Implements Thd_mem_cnt.

◆ free_cnt()

void Thd_mem_cnt_conn::free_cnt ( size_t  size)
overridevirtual

Decrease memory counter at 'free' operation.

Parameters
sizeamount of memory freed.

Implements Thd_mem_cnt.

◆ generate_error()

int Thd_mem_cnt_conn::generate_error ( int  err_no,
ulonglong  mem_limit,
ulonglong  mem_size 
)
private

Generate OOM error and set therad to KILL_CONNECTION state.

Do nothing if thread is already killed or any error is already issued.

Parameters
err_noError number.
mem_limitMemory limit.
mem_sizeMemory size.
Returns
-1 if OOM error is generated, 0 otherwise.

◆ is_error()

bool Thd_mem_cnt_conn::is_error ( )
inlineoverridevirtual

Check if memory counter error is issued.

Return values
trueif memory counter error is issued, false otherwise.

Implements Thd_mem_cnt.

◆ is_error_log_mode()

bool Thd_mem_cnt_conn::is_error_log_mode ( ) const
inlineprivate

Check if memory counter is in error log mode.

Return values
trueif memory counter is in error log mode, false otherwise.

◆ is_error_mode()

bool Thd_mem_cnt_conn::is_error_mode ( ) const
inlineprivate

Check if memory counter is in error mode.

Return values
trueif memory counter is in error mode, false otherwise.

◆ no_error_mode()

void Thd_mem_cnt_conn::no_error_mode ( )
inlineoverridevirtual

Set NO ERROR memory counter mode.

Implements Thd_mem_cnt.

◆ reset()

int Thd_mem_cnt_conn::reset ( void  )
overridevirtual

Funtion resets current memory counter mode and adjust global memory counter according to thread memory counter.

Returns
-1 if OOM error, 0 otherwise.

Implements Thd_mem_cnt.

◆ restore_mode()

void Thd_mem_cnt_conn::restore_mode ( )
inlineoverridevirtual

Restore original memory counter mode.

Implements Thd_mem_cnt.

◆ set_curr_mode()

void Thd_mem_cnt_conn::set_curr_mode ( uint  mode_arg)
inlineoverridevirtual

Function sets current memory counter mode.

Parameters
mode_argcurrent memory counter mode.

Implements Thd_mem_cnt.

◆ set_orig_mode()

void Thd_mem_cnt_conn::set_orig_mode ( uint  mode_arg)
inlineoverridevirtual

Function sets original memory counter mode.

Parameters
mode_argoriginal memory counter mode.

Implements Thd_mem_cnt.

◆ set_thd_error_status()

void Thd_mem_cnt_conn::set_thd_error_status ( )
overridevirtual

Set THD error status using memory counter diagnostics area.

Implements Thd_mem_cnt.

Member Data Documentation

◆ curr_mode

uint Thd_mem_cnt_conn::curr_mode {MEM_CNT_DEFAULT}
private

◆ glob_mem_counter

ulonglong Thd_mem_cnt_conn::glob_mem_counter {0}
private

◆ is_connection_stage

bool Thd_mem_cnt_conn::is_connection_stage {true}
private

◆ m_da

Diagnostics_area Thd_mem_cnt_conn::m_da {false}
private

◆ m_thd

THD* Thd_mem_cnt_conn::m_thd
private

◆ max_conn_mem

ulonglong Thd_mem_cnt_conn::max_conn_mem {0}
private

◆ mem_counter

ulonglong Thd_mem_cnt_conn::mem_counter {0}
private

◆ orig_mode

uint Thd_mem_cnt_conn::orig_mode {MEM_CNT_DEFAULT}
private

The documentation for this class was generated from the following files: