MySQL 8.4.2
Source Code Documentation
Session_sysvars_tracker Class Reference
Inheritance diagram for Session_sysvars_tracker:
[legend]

Classes

struct  sysvar_node_st
 
class  vars_list
 

Public Member Functions

 Session_sysvars_tracker (const CHARSET_INFO *char_set)
 Constructor. More...
 
 ~Session_sysvars_tracker () override
 Destructor. More...
 
void reset ()
 Prepare/reset the m_registered_sysvars hash for next statement. More...
 
bool enable (THD *thd) override
 It is responsible for enabling this tracker when a session starts. More...
 
bool check (THD *thd, set_var *var) override
 Check if any of the system variable name(s) in the given list of system variables is duplicate/invalid. More...
 
bool update (THD *thd) override
 Once the value of the @session_track_system_variables has been successfully updated, this function calls Session_sysvars_tracker::vars_list::update updating the hash in orig_list which represents the system variables to be tracked. More...
 
bool store (THD *thd, String &buf) override
 Store the data for changed system variables in the specified buffer. More...
 
void mark_as_changed (THD *thd, LEX_CSTRING tracked_item_name) override
 Mark the system variable with the specified name as changed. More...
 
void claim_memory_ownership (bool claim) override
 
- Public Member Functions inherited from State_tracker
 State_tracker ()
 Constructor. More...
 
virtual ~State_tracker ()=default
 Destructor. More...
 
bool is_enabled () const
 Getters. More...
 
bool is_changed () const
 

Static Public Member Functions

static bool server_init_check (const CHARSET_INFO *char_set, LEX_STRING var_list)
 Method used to check the validity of string provided for session_track_system_variables during the server startup. More...
 
static const ucharsysvars_get_key (const uchar *entry, size_t *length)
 Supply key to the hash implementation (to be used internally by the implementation). More...
 

Private Attributes

vars_listorig_list
 Two objects of vars_list type are maintained to manage various operations on variables_list. More...
 
vars_listtool_list
 

Additional Inherited Members

- Protected Attributes inherited from State_tracker
bool m_enabled
 Is tracking enabled for a particular session state type ? More...
 
bool m_changed
 Has the session state type changed ? More...
 

Detailed Description

Session_sysvars_tracker

This is a tracker class that enables & manages the tracking of session system variables. It internally maintains a hash of user supplied variable names and a boolean field to store if the variable was changed by the last statement.

Constructor & Destructor Documentation

◆ Session_sysvars_tracker()

Session_sysvars_tracker::Session_sysvars_tracker ( const CHARSET_INFO char_set)
inline

Constructor.

◆ ~Session_sysvars_tracker()

Session_sysvars_tracker::~Session_sysvars_tracker ( )
inlineoverride

Destructor.

Member Function Documentation

◆ check()

bool Session_sysvars_tracker::check ( THD thd,
set_var var 
)
inlineoverridevirtual

Check if any of the system variable name(s) in the given list of system variables is duplicate/invalid.

When the value of @session_track_system_variables system variable is updated, the new value is first verified in this function (called from ON_CHECK()) and a hash is populated in tool_list.

Note
This function is called from the ON_CHECK() function of the session_track_system_variables' sys_var class.
Parameters
thdThe thd handle.
varA pointer to set_var holding the specified list of system variable names.
Returns
true Error false Success

Implements State_tracker.

◆ claim_memory_ownership()

void Session_sysvars_tracker::claim_memory_ownership ( bool  claim)
inlineoverridevirtual

Reimplemented from State_tracker.

◆ enable()

bool Session_sysvars_tracker::enable ( THD thd)
overridevirtual

It is responsible for enabling this tracker when a session starts.

During the initialization, a session's system variable gets a copy of the global variable. The new value of session_track_system_variables is then verified & tokenized to create a hash, which is then updated to orig_list which represents all the systems variables to be tracked.

Parameters
thdThe thd handle.
Returns
true Error false Success

Implements State_tracker.

◆ mark_as_changed()

void Session_sysvars_tracker::mark_as_changed ( THD thd,
LEX_CSTRING  tracked_item_name 
)
overridevirtual

Mark the system variable with the specified name as changed.

Parameters
thdCurrent thread
tracked_item_nameName of the system variable which got changed.

Implements State_tracker.

◆ reset()

void Session_sysvars_tracker::reset ( void  )

Prepare/reset the m_registered_sysvars hash for next statement.

◆ server_init_check()

static bool Session_sysvars_tracker::server_init_check ( const CHARSET_INFO char_set,
LEX_STRING  var_list 
)
inlinestatic

Method used to check the validity of string provided for session_track_system_variables during the server startup.

◆ store()

bool Session_sysvars_tracker::store ( THD thd,
String buf 
)
overridevirtual

Store the data for changed system variables in the specified buffer.

Once the data is stored, we reset the flags related to state-change (see reset()).

Parameters
thdThe thd handle.
[in,out]bufBuffer to store the information to.
Returns
false Success true Error

Implements State_tracker.

◆ sysvars_get_key()

const uchar * Session_sysvars_tracker::sysvars_get_key ( const uchar entry,
size_t *  length 
)
static

Supply key to the hash implementation (to be used internally by the implementation).

Parameters
entryA single entry.
[out]lengthLength of the key.
Returns
Pointer to the key buffer.

◆ update()

bool Session_sysvars_tracker::update ( THD thd)
overridevirtual

Once the value of the @session_track_system_variables has been successfully updated, this function calls Session_sysvars_tracker::vars_list::update updating the hash in orig_list which represents the system variables to be tracked.

Note
This function is called from the ON_UPDATE() function of the session_track_system_variables' sys_var class.
Parameters
thdThe thd handle.
Returns
true Error false Success

Implements State_tracker.

Member Data Documentation

◆ orig_list

vars_list* Session_sysvars_tracker::orig_list
private

Two objects of vars_list type are maintained to manage various operations on variables_list.

◆ tool_list

vars_list * Session_sysvars_tracker::tool_list
private

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