MySQL 9.0.0
Source Code Documentation
PFS_system_variable_cache Class Reference

System variable cache. More...

#include <pfs_variable.h>

Inheritance diagram for PFS_system_variable_cache:
[legend]

Public Member Functions

 PFS_system_variable_cache (bool external_init)
 
bool match_scope (int scope)
 Match system variable scope to desired scope. More...
 
ulonglong get_sysvar_hash_version ()
 
 ~PFS_system_variable_cache () override
 
- Public Member Functions inherited from PFS_variable_cache< System_variable >
 PFS_variable_cache (bool external_init)
 
virtual ~PFS_variable_cache ()=0
 Destructor. More...
 
bool initialize_session ()
 Build array of SHOW_VARs from the external variable source. More...
 
bool initialize_client_session ()
 Build array of SHOW_VARs suitable for aggregation by user, host or account. More...
 
int materialize_global ()
 Build cache of GLOBAL system or status variables. More...
 
int materialize_all (THD *thd)
 Build cache of GLOBAL and SESSION variables for a non-instrumented thread. More...
 
int materialize_session (THD *thd)
 Build cache of SESSION variables for a non-instrumented thread. More...
 
int materialize_session (PFS_thread *pfs_thread, bool use_mem_root=false)
 Build cache of SESSION variables for an instrumented thread. More...
 
int materialize_session (PFS_thread *pfs_thread, uint index)
 Cache a single SESSION variable for an instrumented thread. More...
 
int materialize_user (PFS_user *pfs_user)
 Build cache of SESSION status variables for a user. More...
 
int materialize_host (PFS_host *pfs_host)
 Build cache of SESSION status variables for a host. More...
 
int materialize_account (PFS_account *pfs_account)
 Build cache of SESSION status variables for an account. More...
 
bool is_materialized ()
 True if variables have been materialized. More...
 
bool is_materialized (THD *unsafe_thd)
 True if variables have been materialized for given THD. More...
 
bool is_materialized (PFS_thread *pfs_thread)
 True if variables have been materialized for given PFS_thread. More...
 
bool is_materialized (PFS_user *pfs_user)
 True if variables have been materialized for given PFS_user. More...
 
bool is_materialized (PFS_host *pfs_host)
 True if variables have been materialized for given PFS_host. More...
 
bool is_materialized (PFS_account *pfs_account)
 True if variables have been materialized for given PFS_account. More...
 
bool is_materialized (PFS_client *pfs_client)
 True if variables have been materialized for given PFS_user/host/account. More...
 
THD_ptr get_THD (THD *thd)
 Get a validated THD from the thread manager. More...
 
THD_ptr get_THD (PFS_thread *pfs_thread)
 
const System_variableget (uint index=0) const
 Get a single variable from the cache. More...
 
uint size ()
 Number of elements in the cache. More...
 

Protected Member Functions

bool init_show_var_array (enum_var_type scope, bool strict)
 Build a sorted list of all system variables from the system variable hash. More...
 
int do_materialize_all (THD *thd) override
 Build a GLOBAL and SESSION system variable cache. More...
 

Private Member Functions

bool do_initialize_session () override
 Build an array of SHOW_VARs from the system variable hash. More...
 
int do_materialize_global () override
 Build a GLOBAL system variable cache. More...
 
int do_materialize_session (THD *thd) override
 Build a SESSION system variable cache for a THD. More...
 
int do_materialize_session (PFS_thread *thread) override
 Build a SESSION system variable cache for a pfs_thread. More...
 
int do_materialize_session (PFS_thread *pfs_thread, uint index) override
 Materialize a single system variable for a pfs_thread. More...
 
void set_mem_root ()
 Allocate and assign mem_root for system variable materialization. More...
 
void clear_mem_root ()
 Mark memory blocks in the temporary mem_root as free. More...
 
void free_mem_root ()
 Free the temporary mem_root. More...
 

Private Attributes

MEM_ROOT m_mem_sysvar
 
MEM_ROOT ** m_mem_thd
 
MEM_ROOTm_mem_thd_save
 
MEM_ROOTm_mem_sysvar_ptr
 

Additional Inherited Members

- Public Types inherited from PFS_variable_cache< System_variable >
typedef Prealloced_array< System_variable, SYSTEM_VARIABLE_PREALLOCVariable_array
 
- Protected Attributes inherited from PFS_variable_cache< System_variable >
THDm_safe_thd
 
THDm_unsafe_thd
 
THDm_current_thd
 
PFS_threadm_pfs_thread
 
PFS_clientm_pfs_client
 
Find_THD_variable m_thd_finder
 
Variable_array m_cache
 
bool m_initialized
 
bool m_external_init
 
bool m_materialized
 
Show_var_array m_show_var_array
 
System_variable_tracker::Array m_sys_var_tracker_array
 
ulonglong m_version
 
enum_var_type m_query_scope
 
bool m_use_mem_root
 
bool m_aggregate
 

Detailed Description

System variable cache.

Constructor & Destructor Documentation

◆ PFS_system_variable_cache()

PFS_system_variable_cache::PFS_system_variable_cache ( bool  external_init)
explicit

◆ ~PFS_system_variable_cache()

PFS_system_variable_cache::~PFS_system_variable_cache ( )
inlineoverride

Member Function Documentation

◆ clear_mem_root()

void PFS_system_variable_cache::clear_mem_root ( )
private

Mark memory blocks in the temporary mem_root as free.

Restore THD::mem_root.

◆ do_initialize_session()

bool PFS_system_variable_cache::do_initialize_session ( )
overrideprivatevirtual

Build an array of SHOW_VARs from the system variable hash.

Filter for SESSION scope.

Reimplemented from PFS_variable_cache< System_variable >.

◆ do_materialize_all()

int PFS_system_variable_cache::do_materialize_all ( THD thd)
overrideprotectedvirtual

Build a GLOBAL and SESSION system variable cache.

Reimplemented from PFS_variable_cache< System_variable >.

Reimplemented in PFS_system_variable_info_cache, and PFS_system_persisted_variables_cache.

◆ do_materialize_global()

int PFS_system_variable_cache::do_materialize_global ( )
overrideprivatevirtual

Build a GLOBAL system variable cache.

Reimplemented from PFS_variable_cache< System_variable >.

◆ do_materialize_session() [1/3]

int PFS_system_variable_cache::do_materialize_session ( PFS_thread pfs_thread,
uint  index 
)
overrideprivatevirtual

Materialize a single system variable for a pfs_thread.

Requires that init_show_var_array() has already been called. Return 0 for success.

Reimplemented from PFS_variable_cache< System_variable >.

◆ do_materialize_session() [2/3]

int PFS_system_variable_cache::do_materialize_session ( PFS_thread pfs_thread)
overrideprivatevirtual

Build a SESSION system variable cache for a pfs_thread.

Requires that init_show_var_array() has already been called. Return 0 for success.

Reimplemented from PFS_variable_cache< System_variable >.

◆ do_materialize_session() [3/3]

int PFS_system_variable_cache::do_materialize_session ( THD thd)
overrideprivatevirtual

Build a SESSION system variable cache for a THD.

Reimplemented from PFS_variable_cache< System_variable >.

◆ free_mem_root()

void PFS_system_variable_cache::free_mem_root ( )
private

Free the temporary mem_root.

Restore THD::mem_root if necessary.

◆ get_sysvar_hash_version()

ulonglong PFS_system_variable_cache::get_sysvar_hash_version ( )
inline

◆ init_show_var_array()

bool PFS_system_variable_cache::init_show_var_array ( enum_var_type  scope,
bool  strict 
)
protected

Build a sorted list of all system variables from the system variable hash.

Filter by scope. Must be called inside of LOCK_plugin_delete.

◆ match_scope()

bool PFS_system_variable_cache::match_scope ( int  scope)

Match system variable scope to desired scope.

◆ set_mem_root()

void PFS_system_variable_cache::set_mem_root ( )
private

Allocate and assign mem_root for system variable materialization.

Member Data Documentation

◆ m_mem_sysvar

MEM_ROOT PFS_system_variable_cache::m_mem_sysvar
private

◆ m_mem_sysvar_ptr

MEM_ROOT* PFS_system_variable_cache::m_mem_sysvar_ptr
private

◆ m_mem_thd

MEM_ROOT** PFS_system_variable_cache::m_mem_thd
private

◆ m_mem_thd_save

MEM_ROOT* PFS_system_variable_cache::m_mem_thd_save
private

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