MySQL 9.1.0
Source Code Documentation
pfs_server.cc File Reference

Private interface for the server (implementation). More...

#include "storage/perfschema/pfs_server.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "mysql/strings/m_ctype.h"
#include "mysys_err.h"
#include "sql/mysqld.h"
#include "storage/perfschema/mysql_server_telemetry_logs_client_service_imp.h"
#include "storage/perfschema/mysql_server_telemetry_logs_service_imp.h"
#include "storage/perfschema/mysql_server_telemetry_metrics_service_imp.h"
#include "storage/perfschema/mysql_server_telemetry_traces_service_imp.h"
#include "storage/perfschema/pfs.h"
#include "storage/perfschema/pfs_account.h"
#include "storage/perfschema/pfs_builtin_memory.h"
#include "storage/perfschema/pfs_defaults.h"
#include "storage/perfschema/pfs_digest.h"
#include "storage/perfschema/pfs_engine_table.h"
#include "storage/perfschema/pfs_error.h"
#include "storage/perfschema/pfs_events_stages.h"
#include "storage/perfschema/pfs_events_statements.h"
#include "storage/perfschema/pfs_events_transactions.h"
#include "storage/perfschema/pfs_events_waits.h"
#include "storage/perfschema/pfs_global.h"
#include "storage/perfschema/pfs_host.h"
#include "storage/perfschema/pfs_instr.h"
#include "storage/perfschema/pfs_instr_class.h"
#include "storage/perfschema/pfs_metrics_service_imp.h"
#include "storage/perfschema/pfs_plugin_table.h"
#include "storage/perfschema/pfs_prepared_stmt.h"
#include "storage/perfschema/pfs_program.h"
#include "storage/perfschema/pfs_setup_actor.h"
#include "storage/perfschema/pfs_setup_object.h"
#include "storage/perfschema/pfs_timer.h"
#include "storage/perfschema/pfs_tls_channel.h"
#include "storage/perfschema/pfs_user.h"
#include "template_utils.h"

Functions

static void cleanup_performance_schema ()
 
void cleanup_instrument_config ()
 Deallocate the PFS_INSTRUMENT array. More...
 
void cleanup_meter_config ()
 Deallocate the PFS_METER array. More...
 
void cleanup_logger_config ()
 Deallocate the PFS_LOGGER array. More...
 
void pre_initialize_performance_schema ()
 Null initialization. More...
 
int initialize_performance_schema (PFS_global_param *param, PSI_thread_bootstrap **thread_bootstrap, PSI_mutex_bootstrap **mutex_bootstrap, PSI_rwlock_bootstrap **rwlock_bootstrap, PSI_cond_bootstrap **cond_bootstrap, PSI_file_bootstrap **file_bootstrap, PSI_socket_bootstrap **socket_bootstrap, PSI_table_bootstrap **table_bootstrap, PSI_mdl_bootstrap **mdl_bootstrap, PSI_idle_bootstrap **idle_bootstrap, PSI_stage_bootstrap **stage_bootstrap, PSI_statement_bootstrap **statement_bootstrap, PSI_transaction_bootstrap **transaction_bootstrap, PSI_memory_bootstrap **memory_bootstrap, PSI_error_bootstrap **error_bootstrap, PSI_data_lock_bootstrap **data_lock_bootstrap, PSI_system_bootstrap **system_bootstrap, PSI_tls_channel_bootstrap **tls_channel_bootstrap, PSI_metric_bootstrap **metric_bootstrap, PSI_logs_client_bootstrap **logs_client_bootstrap)
 Initialize the performance schema. More...
 
void shutdown_performance_schema ()
 Shutdown the performance schema. More...
 
void init_pfs_instrument_array ()
 Initialize the dynamic array used to hold PFS_INSTRUMENT configuration options. More...
 
int add_pfs_instr_to_array (const char *name, const char *value)
 Process one performance_schema_instrument configuration string. More...
 
void init_pfs_meter_array ()
 Initialize the dynamic array used to hold PFS_METER configuration options. More...
 
void init_pfs_logger_array ()
 Initialize the dynamic array used to hold PFS_LOGGER configuration options. More...
 
int add_pfs_meter_to_array (const char *name, const char *value)
 Process one performance_schema_meter configuration string. More...
 
int add_pfs_logger_to_array (const char *name, const char *value)
 Process one performance_schema_logger configuration string. More...
 

Variables

PFS_global_param pfs_param
 Performance schema sizing values for the server. More...
 

Detailed Description

Private interface for the server (implementation).

Function Documentation

◆ add_pfs_instr_to_array()

int add_pfs_instr_to_array ( const char *  name,
const char *  value 
)

Process one performance_schema_instrument configuration string.

Process one PFS_INSTRUMENT configuration string.

Isolate the instrument name, evaluate the option value, and store them in a dynamic array. Return 'false' for success, 'true' for error.

Parameters
nameInstrument name
valueConfiguration option: 'on', 'off', etc.
Returns
0 for success, non zero for errors

◆ add_pfs_logger_to_array()

int add_pfs_logger_to_array ( const char *  name,
const char *  value 
)

Process one performance_schema_logger configuration string.

Process one PFS_LOGGER configuration string.

Isolate the instrument name, evaluate the option values, and store them in a dynamic array. Return 'false' for success, 'true' for error.

Parameters
nameInstrument name
valueConfiguration option: 'level:INFO', 'level:NONE', etc.
Returns
0 for success, non zero for errors

◆ add_pfs_meter_to_array()

int add_pfs_meter_to_array ( const char *  name,
const char *  value 
)

Process one performance_schema_meter configuration string.

Process one PFS_METER configuration string.

Isolate the instrument name, evaluate the option values, and store them in a dynamic array. Return 'false' for success, 'true' for error.

Parameters
nameInstrument name
valueConfiguration option: 'enabled:ON,frequency:30', 'enabled:OFF', etc.
Returns
0 for success, non zero for errors

◆ cleanup_instrument_config()

void cleanup_instrument_config ( )

Deallocate the PFS_INSTRUMENT array.

◆ cleanup_logger_config()

void cleanup_logger_config ( )

Deallocate the PFS_LOGGER array.

◆ cleanup_meter_config()

void cleanup_meter_config ( )

Deallocate the PFS_METER array.

◆ cleanup_performance_schema()

static void cleanup_performance_schema ( )
static

◆ init_pfs_instrument_array()

void init_pfs_instrument_array ( )

Initialize the dynamic array used to hold PFS_INSTRUMENT configuration options.

Initialize the dynamic array holding individual instrument settings collected from the server configuration options.

◆ init_pfs_logger_array()

void init_pfs_logger_array ( )

Initialize the dynamic array used to hold PFS_LOGGER configuration options.

Initialize the dynamic array holding individual logger instrument settings collected from the server configuration options.

◆ init_pfs_meter_array()

void init_pfs_meter_array ( )

Initialize the dynamic array used to hold PFS_METER configuration options.

Initialize the dynamic array holding individual meter instrument settings collected from the server configuration options.

◆ initialize_performance_schema()

int initialize_performance_schema ( PFS_global_param param,
PSI_thread_bootstrap **  thread_bootstrap,
PSI_mutex_bootstrap **  mutex_bootstrap,
PSI_rwlock_bootstrap **  rwlock_bootstrap,
PSI_cond_bootstrap **  cond_bootstrap,
PSI_file_bootstrap **  file_bootstrap,
PSI_socket_bootstrap **  socket_bootstrap,
PSI_table_bootstrap **  table_bootstrap,
PSI_mdl_bootstrap **  mdl_bootstrap,
PSI_idle_bootstrap **  idle_bootstrap,
PSI_stage_bootstrap **  stage_bootstrap,
PSI_statement_bootstrap **  statement_bootstrap,
PSI_transaction_bootstrap **  transaction_bootstrap,
PSI_memory_bootstrap **  memory_bootstrap,
PSI_error_bootstrap **  error_bootstrap,
PSI_data_lock_bootstrap **  data_lock_bootstrap,
PSI_system_bootstrap **  system_bootstrap,
PSI_tls_channel_bootstrap **  tls_channel_bootstrap,
PSI_metric_bootstrap **  metric_bootstrap,
PSI_logs_client_bootstrap **  logs_client_bootstrap 
)

Initialize the performance schema.

The performance schema implement several instrumentation services. Each instrumentation service is versioned, and accessible through a bootstrap structure, returned as output parameter.

Parameters
paramSize parameters to use.
[out]thread_bootstrapThread instrumentation service bootstrap
[out]mutex_bootstrapMutex instrumentation service bootstrap
[out]rwlock_bootstrapRwlock instrumentation service bootstrap
[out]cond_bootstrapCondition instrumentation service bootstrap
[out]file_bootstrapFile instrumentation service bootstrap
[out]socket_bootstrapSocket instrumentation service bootstrap
[out]table_bootstrapTable instrumentation service bootstrap
[out]mdl_bootstrapMetadata Lock instrumentation service bootstrap
[out]idle_bootstrapIdle instrumentation service bootstrap
[out]stage_bootstrapStage instrumentation service bootstrap
[out]statement_bootstrapStatement instrumentation service bootstrap
[out]transaction_bootstrapTransaction instrumentation service bootstrap
[out]memory_bootstrapMemory instrumentation service bootstrap
[out]error_bootstrapError instrumentation service bootstrap
[out]data_lock_bootstrapData Lock instrumentation service bootstrap
[out]system_bootstrapSystem instrumentation service bootstrap
[out]tls_channel_bootstrapTLS channel instrumentation service bootstrap
[out]metric_bootstrapTelemetry metrics instrumentation service bootstrap
[out]logs_client_bootstrapTelemetry logs client instrumentation service bootstrap
Return values
0success

Default values for SETUP_CONSUMERS

◆ pre_initialize_performance_schema()

void pre_initialize_performance_schema ( )

Null initialization.

Disable all instrumentation, size all internal buffers to 0. This pre initialization step is needed to ensure that events can be collected and discarded, until such time initialize_performance_schema() is called.

◆ shutdown_performance_schema()

void shutdown_performance_schema ( )

Shutdown the performance schema.

Variable Documentation

◆ pfs_param

PFS_global_param pfs_param

Performance schema sizing values for the server.

This global variable is set when parsing server startup options.