MySQL 9.0.0
Source Code Documentation
PFS_status_variable_cache Class Reference

Status variable cache. More...

#include <pfs_variable.h>

Inheritance diagram for PFS_status_variable_cache:
[legend]

Public Member Functions

 PFS_status_variable_cache (bool external_init)
 CLASS PFS_status_variable_cache. 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...
 
ulonglong get_status_array_version ()
 
- Public Member Functions inherited from PFS_variable_cache< Status_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 Status_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

virtual PFS_clientget_pfs (PFS_thread *)
 

Protected Attributes

bool m_show_command
 
- Protected Attributes inherited from PFS_variable_cache< Status_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
 

Private Member Functions

bool do_initialize_session () override
 Build an internal SHOW_VAR array from the external status variable array. More...
 
int do_materialize_global () override
 Build cache for GLOBAL status variables using values totaled from all threads. More...
 
int do_materialize_all (THD *thd) override
 Build GLOBAL and SESSION status variable cache using values for a non-instrumented thread. More...
 
int do_materialize_session (THD *thd) override
 Build SESSION status variable cache using values for a non-instrumented thread. More...
 
int do_materialize_session (PFS_thread *thread) override
 Build SESSION status variable cache using values for a PFS_thread. More...
 
int do_materialize_session (PFS_thread *, uint) override
 
int do_materialize_client (PFS_client *pfs_client)
 Build cache of SESSION status variables using the status values provided. More...
 
bool init_show_var_array (enum_var_type scope, bool strict)
 Build an array of SHOW_VARs from the global status array. More...
 
void expand_show_var_array (const SHOW_VAR *show_var_array, const char *prefix, bool strict)
 Expand a nested sub array of status variables, indicated by a type of SHOW_ARRAY. More...
 
bool filter_show_var (const SHOW_VAR *show_var, bool strict)
 Check if a status variable should be excluded from the query. More...
 
bool match_scope (SHOW_SCOPE variable_scope, bool strict)
 Compare status variable scope to desired scope. More...
 
bool filter_by_name (const SHOW_VAR *show_var)
 
bool can_aggregate (enum_mysql_show_type variable_type)
 Check that the variable type is aggregatable. More...
 
char * make_show_var_name (const char *prefix, const char *name, char *name_buf, size_t buf_len)
 Build the complete status variable name, with prefix. More...
 
char * make_show_var_name (const char *prefix, const char *name)
 Make a copy of the name string prefixed with the sub array name if necessary. More...
 
System_status_varset_status_vars ()
 For the current THD, use initial_status_vars taken from before the query start. More...
 
void manifest (THD *thd, const SHOW_VAR *show_var_array, System_status_var *vars, const char *prefix, bool nested_array, bool strict)
 

Private Attributes

void(* m_sum_client_status )(PFS_client *pfs_client, System_status_var *status_totals)
 

Additional Inherited Members

- Public Types inherited from PFS_variable_cache< Status_variable >
typedef Prealloced_array< Status_variable, SYSTEM_VARIABLE_PREALLOCVariable_array
 

Detailed Description

Status variable cache.

Constructor & Destructor Documentation

◆ PFS_status_variable_cache()

PFS_status_variable_cache::PFS_status_variable_cache ( bool  external_init)
explicit

CLASS PFS_status_variable_cache.

Member Function Documentation

◆ can_aggregate()

bool PFS_status_variable_cache::can_aggregate ( enum_mysql_show_type  variable_type)
private

Check that the variable type is aggregatable.

Parameters
variable_typeStatus variable type
Returns
true if variable type can be aggregated

◆ do_initialize_session()

bool PFS_status_variable_cache::do_initialize_session ( )
overrideprivatevirtual

Build an internal SHOW_VAR array from the external status variable array.

Reimplemented from PFS_variable_cache< Status_variable >.

◆ do_materialize_all()

int PFS_status_variable_cache::do_materialize_all ( THD thd)
overrideprivatevirtual

Build GLOBAL and SESSION status variable cache using values for a non-instrumented thread.

Reimplemented from PFS_variable_cache< Status_variable >.

◆ do_materialize_client()

int PFS_status_variable_cache::do_materialize_client ( PFS_client pfs_client)
private

Build cache of SESSION status variables using the status values provided.

The cache is associated with a user, host or account, but not with any particular thread. NOTE: Requires that init_show_var_array() has already been called.

◆ do_materialize_global()

int PFS_status_variable_cache::do_materialize_global ( )
overrideprivatevirtual

Build cache for GLOBAL status variables using values totaled from all threads.

Reimplemented from PFS_variable_cache< Status_variable >.

◆ do_materialize_session() [1/3]

int PFS_status_variable_cache::do_materialize_session ( PFS_thread ,
uint   
)
inlineoverrideprivatevirtual

◆ do_materialize_session() [2/3]

int PFS_status_variable_cache::do_materialize_session ( PFS_thread pfs_thread)
overrideprivatevirtual

Build SESSION status variable cache using values for a PFS_thread.

NOTE: Requires that init_show_var_array() has already been called.

Reimplemented from PFS_variable_cache< Status_variable >.

◆ do_materialize_session() [3/3]

int PFS_status_variable_cache::do_materialize_session ( THD thd)
overrideprivatevirtual

Build SESSION status variable cache using values for a non-instrumented thread.

Reimplemented from PFS_variable_cache< Status_variable >.

◆ expand_show_var_array()

void PFS_status_variable_cache::expand_show_var_array ( const SHOW_VAR show_var_array,
const char *  prefix,
bool  strict 
)
private

Expand a nested sub array of status variables, indicated by a type of SHOW_ARRAY.

◆ filter_by_name()

bool PFS_status_variable_cache::filter_by_name ( const SHOW_VAR show_var)
private

◆ filter_show_var()

bool PFS_status_variable_cache::filter_show_var ( const SHOW_VAR show_var,
bool  strict 
)
private

Check if a status variable should be excluded from the query.

Return true if the variable should be excluded.

◆ get_pfs()

virtual PFS_client * PFS_status_variable_cache::get_pfs ( PFS_thread )
inlineprotectedvirtual

◆ get_status_array_version()

ulonglong PFS_status_variable_cache::get_status_array_version ( )
inline

◆ init_show_var_array()

bool PFS_status_variable_cache::init_show_var_array ( enum_var_type  scope,
bool  strict 
)
private

Build an array of SHOW_VARs from the global status array.

Expand nested sub arrays, filter unwanted variables. NOTE: Must be done inside of LOCK_status to guard against plugin load/unload.

◆ make_show_var_name() [1/2]

char * PFS_status_variable_cache::make_show_var_name ( const char *  prefix,
const char *  name 
)
private

Make a copy of the name string prefixed with the sub array name if necessary.

◆ make_show_var_name() [2/2]

char * PFS_status_variable_cache::make_show_var_name ( const char *  prefix,
const char *  name,
char *  name_buf,
size_t  buf_len 
)
private

Build the complete status variable name, with prefix.

Return in buffer provided.

◆ manifest()

void PFS_status_variable_cache::manifest ( THD thd,
const SHOW_VAR show_var_array,
System_status_var vars,
const char *  prefix,
bool  nested_array,
bool  strict 
)
private

◆ match_scope()

bool PFS_status_variable_cache::match_scope ( SHOW_SCOPE  variable_scope,
bool  strict 
)
private

Compare status variable scope to desired scope.

Parameters
variable_scopeScope of current status variable
strictStrict mode, for compatibility with SHOW
Returns
true if variable matches the query scope

◆ materialize_account()

int PFS_status_variable_cache::materialize_account ( PFS_account pfs_account)

Build cache of SESSION status variables for an account.

◆ materialize_host()

int PFS_status_variable_cache::materialize_host ( PFS_host pfs_host)

Build cache of SESSION status variables for a host.

◆ materialize_user()

int PFS_status_variable_cache::materialize_user ( PFS_user pfs_user)

Build cache of SESSION status variables for a user.

◆ set_status_vars()

System_status_var * PFS_status_variable_cache::set_status_vars ( )
private

For the current THD, use initial_status_vars taken from before the query start.

Member Data Documentation

◆ m_show_command

bool PFS_status_variable_cache::m_show_command
protected

◆ m_sum_client_status

void(* PFS_status_variable_cache::m_sum_client_status) (PFS_client *pfs_client, System_status_var *status_totals)
private

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