MySQL 9.1.0
Source Code Documentation
ha_perfschema.cc File Reference

Performance schema storage engine (implementation). More...

#include "storage/perfschema/ha_perfschema.h"
#include <string.h>
#include <atomic>
#include "lex_string.h"
#include "lf.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql/components/services/pfs_plugin_table_service.h"
#include "mysql/plugin.h"
#include "mysql/status_var.h"
#include "mysql/strings/int2str.h"
#include "mysqld_error.h"
#include "nulls.h"
#include "sql/hostname_cache.h"
#include "sql/mysqld.h"
#include "sql/sql_class.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "storage/perfschema/pfs_account.h"
#include "storage/perfschema/pfs_buffer_container.h"
#include "storage/perfschema/pfs_builtin_memory.h"
#include "storage/perfschema/pfs_column_values.h"
#include "storage/perfschema/pfs_dd_version.h"
#include "storage/perfschema/pfs_digest.h"
#include "storage/perfschema/pfs_engine_table.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_program.h"
#include "storage/perfschema/pfs_setup_actor.h"
#include "storage/perfschema/pfs_setup_object.h"
#include "storage/perfschema/pfs_stat.h"
#include "storage/perfschema/pfs_user.h"

Namespaces

namespace  dd
 The version of the current data dictionary table definitions.
 

Macros

#define PFS_ENABLED()    (pfs_initialized && (pfs_enabled || m_table_share->m_perpetual))
 
#define IS_NATIVE_TABLE(X)   ((X)->m_st_table.open_table == NULL)
 

Functions

static void lock_pfs_external_table_shares ()
 
static void unlock_pfs_external_table_shares ()
 
static handlerpfs_create_handler (handlerton *hton, TABLE_SHARE *table, bool, MEM_ROOT *mem_root)
 
static size_t size_of_global_error_stat_buffer ()
 
static size_t size_of_session_error_stat_buffer ()
 
static bool pfs_show_status (handlerton *, THD *thd, stat_print_fn *print, enum ha_stat_type stat)
 SHOW ENGINE PERFORMANCE_SCHEMA STATUS. More...
 
static void inc_ref_count (PFS_engine_table_share *share)
 
static void dec_ref_count (PFS_engine_table_share *share)
 
static int compare_database_names (const char *name1, const char *name2)
 
static PFS_engine_table_sharefind_table_share (const char *db, const char *name)
 
static bool pfs_dict_init (dict_init_mode_t dict_init_mode, uint version, List< const Plugin_table > *tables, List< const Plugin_tablespace > *tablespaces)
 Initialize Performance Schema tables in the Data Dictionary. More...
 
static bool pfs_sdi_set_ignored (handlerton *, const dd::Tablespace &, const dd::Table *, const sdi_key_t *, const void *, uint64)
 
static bool pfs_sdi_delete_ignored (const dd::Tablespace &, const dd::Table *, const sdi_key_t *)
 
static bool pfs_sdi_get_ignored (const dd::Tablespace &, const sdi_key_t *, void *, uint64 *)
 
static bool pfs_sdi_create_ignored (dd::Tablespace *)
 
static bool pfs_sdi_drop_ignored (dd::Tablespace *)
 
static bool pfs_sdi_get_keys_ignored (const dd::Tablespace &, sdi_vector_t &)
 
void pfs_sdi_disable ()
 
void pfs_sdi_enable ()
 
static int pfs_init_func (void *p)
 
static int pfs_done_func (void *)
 
static int show_func_mutex_instances_lost (THD *, SHOW_VAR *var, char *buff)
 
 mysql_declare_plugin (perfschema)
 

Variables

handlertonpfs_hton = nullptr
 
static SHOW_VAR pfs_status_vars []
 
struct st_mysql_storage_engine pfs_storage_engine
 
const char * pfs_engine_name = "PERFORMANCE_SCHEMA"
 Name of the performance schema engine. More...
 
 mysql_declare_plugin_end
 

Detailed Description

Performance schema storage engine (implementation).

Macro Definition Documentation

◆ IS_NATIVE_TABLE

#define IS_NATIVE_TABLE (   X)    ((X)->m_st_table.open_table == NULL)

◆ PFS_ENABLED

#define PFS_ENABLED ( )     (pfs_initialized && (pfs_enabled || m_table_share->m_perpetual))

Function Documentation

◆ compare_database_names()

static int compare_database_names ( const char *  name1,
const char *  name2 
)
static

◆ dec_ref_count()

static void dec_ref_count ( PFS_engine_table_share share)
static

◆ find_table_share()

static PFS_engine_table_share * find_table_share ( const char *  db,
const char *  name 
)
static

◆ inc_ref_count()

static void inc_ref_count ( PFS_engine_table_share share)
static

◆ lock_pfs_external_table_shares()

static void lock_pfs_external_table_shares ( )
static

◆ mysql_declare_plugin()

mysql_declare_plugin ( perfschema  )

◆ pfs_create_handler()

static handler * pfs_create_handler ( handlerton hton,
TABLE_SHARE table,
bool  ,
MEM_ROOT mem_root 
)
static

◆ pfs_dict_init()

static bool pfs_dict_init ( dict_init_mode_t  dict_init_mode,
uint  version,
List< const Plugin_table > *  tables,
List< const Plugin_tablespace > *  tablespaces 
)
static

Initialize Performance Schema tables in the Data Dictionary.

Create strings representing the required performance schema tables, i.e. tables that InnoDB expects to exist in the DD, and add them to the appropriate out parameter.

Parameters
[in]dict_init_modeHow to initialize files
[in]versionTarget DD version if a new server is being installed. 0 if restarting an existing server.
[out]tablesList of SQL DDL statements for creating DD tables that are needed by the DDSE.
[out]tablespacesList of meta data for predefined tablespaces created by the DDSE.
Return values
trueAn error occurred.
falseSuccess - no errors.

◆ pfs_done_func()

static int pfs_done_func ( void *  )
static

◆ pfs_init_func()

static int pfs_init_func ( void *  p)
static

◆ pfs_sdi_create_ignored()

static bool pfs_sdi_create_ignored ( dd::Tablespace )
static

◆ pfs_sdi_delete_ignored()

static bool pfs_sdi_delete_ignored ( const dd::Tablespace ,
const dd::Table ,
const sdi_key_t  
)
static

◆ pfs_sdi_disable()

void pfs_sdi_disable ( )

◆ pfs_sdi_drop_ignored()

static bool pfs_sdi_drop_ignored ( dd::Tablespace )
static

◆ pfs_sdi_enable()

void pfs_sdi_enable ( )

◆ pfs_sdi_get_ignored()

static bool pfs_sdi_get_ignored ( const dd::Tablespace ,
const sdi_key_t ,
void *  ,
uint64  
)
static

◆ pfs_sdi_get_keys_ignored()

static bool pfs_sdi_get_keys_ignored ( const dd::Tablespace ,
sdi_vector_t  
)
static

◆ pfs_sdi_set_ignored()

static bool pfs_sdi_set_ignored ( handlerton ,
const dd::Tablespace ,
const dd::Table ,
const sdi_key_t ,
const void *  ,
uint64   
)
static

◆ pfs_show_status()

static bool pfs_show_status ( handlerton ,
THD thd,
stat_print_fn print,
enum ha_stat_type  stat 
)
static

SHOW ENGINE PERFORMANCE_SCHEMA STATUS.

Parameters
thdCurrent thread
printPrint function
statstatus to show

◆ show_func_mutex_instances_lost()

static int show_func_mutex_instances_lost ( THD ,
SHOW_VAR var,
char *  buff 
)
static

◆ size_of_global_error_stat_buffer()

static size_t size_of_global_error_stat_buffer ( )
static

◆ size_of_session_error_stat_buffer()

static size_t size_of_session_error_stat_buffer ( )
static

◆ unlock_pfs_external_table_shares()

static void unlock_pfs_external_table_shares ( )
static

Variable Documentation

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ pfs_hton

handlerton* pfs_hton = nullptr

◆ pfs_status_vars

SHOW_VAR pfs_status_vars[]
static

◆ pfs_storage_engine

struct st_mysql_storage_engine pfs_storage_engine
Initial value:
= {
#define MYSQL_HANDLERTON_INTERFACE_VERSION
Definition: plugin.h:704