MySQL 9.0.0
Source Code Documentation
table_variables_metadata.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_VARIABLES_METADATA_H
25#define TABLE_VARIABLES_METADATA_H
26
27/**
28 @file storage/perfschema/table_variables_metadata.h
29 Table VARIABLES_META (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
37#include "mysql_com.h"
41
42class Field;
43class Plugin_table;
44struct TABLE;
45struct THR_LOCK;
46
47/**
48 Calculated from sys_var::flag_enum
49*/
54};
55
56/**
57 Calculated from enum_mysql_show_type
58*/
61 TYPE_NUMERIC, // double
65 TYPE_SET // set, flagset
66};
67
68/**
69 A row of table
70 PERFORMANCE_SCHEMA.VARIABLES_METADATA.
71*/
77
78 /** Column VARIABLE_NAME. */
81 /** Column VARIABLE_SCOPE. */
83 /** Column DATA_TYPE. */
85 /** Column MIN_VALUE. */
88 /** Column MAX_VALUE. */
91 /** Column DOCUMENTATION. */
94};
95
96/** Table PERFORMANCE_SCHEMA.VARIABLES_METADATA. */
101
102 public:
103 /** Table share */
106 static ha_rows get_row_count();
107
108 int rnd_init(bool scan) override;
109 int rnd_next() override;
110 int rnd_pos(const void *pos) override;
111 void reset_position() override;
112
113 protected:
114 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
115 bool read_all) override;
117
118 public:
119 ~table_variables_metadata() override = default;
120
121 protected:
122 /* Build sys_var tracker array. */
123 bool init_sys_var_array();
124 /* Build sys_var info cache. */
125 int do_materialize_all();
126
127 int make_row(const row_variables_metadata &row);
128
129 private:
130 /** Table share lock. */
132 /** Table definition. */
134
135 /* True when system variable descriptors array is complete. */
137 /* Array of system variable descriptors. */
139 /* Cache of materialized variables. */
141 /* True when cache is complete. */
143 /* Version of global hash/array. Changes when vars added/removed. */
145
146 /** Current row. */
148 /** Current position. */
150 /** Next position. */
152};
153
154#endif
Definition: field.h:577
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
A class representing one system variable - that is something that can be accessed as @global....
Definition: set_var.h:107
Table PERFORMANCE_SCHEMA.VARIABLES_METADATA.
Definition: table_variables_metadata.h:97
ulonglong m_version
Definition: table_variables_metadata.h:144
bool m_initialized
Definition: table_variables_metadata.h:136
pos_t m_pos
Current position.
Definition: table_variables_metadata.h:149
bool init_sys_var_array()
Build a sorted list of all system variables from the system variable hash.
Definition: table_variables_metadata.cc:236
bool m_materialized
Definition: table_variables_metadata.h:142
int do_materialize_all()
Build a GLOBAL system variable cache.
Definition: table_variables_metadata.cc:267
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_variables_metadata.cc:321
int make_row(const row_variables_metadata &row)
Definition: table_variables_metadata.cc:329
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_variables_metadata.cc:300
static Plugin_table m_table_def
Table definition.
Definition: table_variables_metadata.h:133
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_variables_metadata.cc:305
Prealloced_array< row_variables_metadata, SYSTEM_VARIABLE_PREALLOC > Variable_array
Definition: table_variables_metadata.h:100
static PFS_engine_table_share m_share
Table share.
Definition: table_variables_metadata.h:104
~table_variables_metadata() override=default
row_variables_metadata m_row
Current row.
Definition: table_variables_metadata.h:147
PFS_simple_index pos_t
Definition: table_variables_metadata.h:98
pos_t m_next_pos
Next position.
Definition: table_variables_metadata.h:151
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_variables_metadata.cc:334
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_variables_metadata.cc:311
static ha_rows get_row_count()
Definition: table_variables_metadata.cc:210
System_variable_tracker::Array m_sys_var_tracker_array
Definition: table_variables_metadata.h:138
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_variables_metadata.cc:206
static THR_LOCK m_table_lock
Table share lock.
Definition: table_variables_metadata.h:131
table_variables_metadata()
Definition: table_variables_metadata.cc:222
Variable_array m_cache
Definition: table_variables_metadata.h:140
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Common definition between mysql server & client.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Data types for columns used in the performance schema tables (declarations)
#define COL_OBJECT_NAME_SIZE
Size of the OBJECT_NAME columns, in bytes.
Definition: pfs_column_types.h:55
#define COL_INFO_SIZE
Size of INFO columns, in bytes.
Definition: pfs_column_types.h:71
Performance schema tables (declarations).
Performance schema system and status variables (declarations).
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Definition: table.h:1407
Definition: thr_lock.h:139
A row of table PERFORMANCE_SCHEMA.VARIABLES_METADATA.
Definition: table_variables_metadata.h:72
char m_min_value[COL_OBJECT_NAME_SIZE]
Column MIN_VALUE.
Definition: table_variables_metadata.h:86
row_variables_metadata()
Definition: table_variables_metadata.cc:84
row_variables_metadata & operator=(const row_variables_metadata &other)
Definition: table_variables_metadata.cc:187
enum_variable_scope m_variable_scope
Column VARIABLE_SCOPE.
Definition: table_variables_metadata.h:82
enum_variable_data_type m_variable_data_type
Column DATA_TYPE.
Definition: table_variables_metadata.h:84
uint m_documentation_length
Definition: table_variables_metadata.h:93
char m_max_value[COL_OBJECT_NAME_SIZE]
Column MAX_VALUE.
Definition: table_variables_metadata.h:89
uint m_variable_name_length
Definition: table_variables_metadata.h:80
uint m_min_value_length
Definition: table_variables_metadata.h:87
uint m_max_value_length
Definition: table_variables_metadata.h:90
char m_documentation[COL_INFO_SIZE]
Column DOCUMENTATION.
Definition: table_variables_metadata.h:92
char m_variable_name[COL_OBJECT_NAME_SIZE]
Column VARIABLE_NAME.
Definition: table_variables_metadata.h:79
enum_variable_scope
Calculated from sys_var::flag_enum.
Definition: table_variables_metadata.h:50
@ SCOPE_SESSION
Definition: table_variables_metadata.h:52
@ SCOPE_SESSION_ONLY
Definition: table_variables_metadata.h:53
@ SCOPE_GLOBAL
Definition: table_variables_metadata.h:51
enum_variable_data_type
Calculated from enum_mysql_show_type.
Definition: table_variables_metadata.h:59
@ TYPE_ENUMERATION
Definition: table_variables_metadata.h:63
@ TYPE_BOOLEAN
Definition: table_variables_metadata.h:64
@ TYPE_INTEGER
Definition: table_variables_metadata.h:60
@ TYPE_SET
Definition: table_variables_metadata.h:65
@ TYPE_STRING
Definition: table_variables_metadata.h:62
@ TYPE_NUMERIC
Definition: table_variables_metadata.h:61