MySQL 8.4.2
Source Code Documentation
pfs_server.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 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 PFS_SERVER_H
25#define PFS_SERVER_H
26
27/**
28 @file storage/perfschema/pfs_server.h
29 Private interface for the server (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_psi_config.h"
35#include "mysql/psi/psi_cond.h"
37#include "mysql/psi/psi_error.h"
38#include "mysql/psi/psi_file.h"
39#include "mysql/psi/psi_idle.h"
40#include "mysql/psi/psi_mdl.h"
42#include "mysql/psi/psi_mutex.h"
45#include "mysql/psi/psi_stage.h"
48#include "mysql/psi/psi_table.h"
52
53#ifdef HAVE_PSI_INTERFACE
54
55#define PFS_AUTOSCALE_VALUE (-1)
56#define PFS_AUTOSIZE_VALUE (-1)
57
58#ifndef PFS_MAX_MUTEX_CLASS
59#define PFS_MAX_MUTEX_CLASS 350
60#endif
61#ifndef PFS_MAX_RWLOCK_CLASS
62#define PFS_MAX_RWLOCK_CLASS 100
63#endif
64#ifndef PFS_MAX_COND_CLASS
65#define PFS_MAX_COND_CLASS 150
66#endif
67#ifndef PFS_MAX_THREAD_CLASS
68#define PFS_MAX_THREAD_CLASS 100
69#endif
70#ifndef PFS_MAX_FILE_CLASS
71#define PFS_MAX_FILE_CLASS 80
72#endif
73#ifndef PFS_MAX_FILE_HANDLE
74#define PFS_MAX_FILE_HANDLE 32768
75#endif
76#ifndef PFS_MAX_SOCKET_CLASS
77#define PFS_MAX_SOCKET_CLASS 10
78#endif
79#ifndef PFS_MAX_STAGE_CLASS
80#define PFS_MAX_STAGE_CLASS 175
81#endif
82#ifndef PFS_STATEMENTS_STACK_SIZE
83#define PFS_STATEMENTS_STACK_SIZE 10
84#endif
85#ifndef PFS_MAX_MEMORY_CLASS
86#define PFS_MAX_MEMORY_CLASS 470
87#endif
88#ifndef PFS_MAX_METER_CLASS
89#define PFS_MAX_METER_CLASS 30
90#endif
91#ifndef PFS_MAX_METRIC_CLASS
92#define PFS_MAX_METRIC_CLASS 600
93#endif
94
95#ifndef PFS_MAX_GLOBAL_SERVER_ERRORS
96#define PFS_MAX_GLOBAL_SERVER_ERRORS \
97 (1 + pfs_session_error_stat_count + pfs_global_error_stat_count)
98#endif
99
100#ifndef PFS_MAX_SESSION_SERVER_ERRORS
101#define PFS_MAX_SESSION_SERVER_ERRORS (1 + pfs_session_error_stat_count)
102#endif
103
104/** Sizing hints, from the server configuration. */
106 /** Value of @c Sys_table_def_size */
108 /** Value of @c Sys_table_cache_size */
110 /** Value of @c Sys_max_connections */
112 /** Value of @c Sys_open_files_limit */
114 /** Value of @c Sys_max_prepared_stmt_count */
116};
117
118/** Performance schema global sizing parameters. */
120 /** True if the performance schema is enabled. */
122 /** Default values for SETUP_CONSUMERS. */
139
140 /** True if SHOW PROCESSLIST is enabeld in the performance schema. */
142
143 /** Default instrument configuration option. */
145
146 /**
147 Maximum number of instrumented mutex classes.
148 @sa mutex_class_lost.
149 */
151 /**
152 Maximum number of instrumented rwlock classes.
153 @sa rwlock_class_lost.
154 */
156 /**
157 Maximum number of instrumented cond classes.
158 @sa cond_class_lost.
159 */
161 /**
162 Maximum number of instrumented thread classes.
163 @sa thread_class_lost.
164 */
166 /**
167 Maximum number of instrumented table share.
168 @sa table_share_lost.
169 */
171 /**
172 Maximum number of lock statistics collected for tables.
173 @sa table_lock_stat_lost.
174 */
176 /**
177 Maximum number of index statistics collected for tables.
178 @sa table_index_lost.
179 */
181 /**
182 Maximum number of instrumented file classes.
183 @sa file_class_lost.
184 */
186 /**
187 Maximum number of instrumented mutex instances.
188 @sa mutex_lost.
189 */
191 /**
192 Maximum number of instrumented rwlock instances.
193 @sa rwlock_lost.
194 */
196 /**
197 Maximum number of instrumented cond instances.
198 @sa cond_lost.
199 */
201 /**
202 Maximum number of instrumented thread instances.
203 @sa thread_lost.
204 */
206 /**
207 Maximum number of instrumented table handles.
208 @sa table_lost.
209 */
211 /**
212 Maximum number of instrumented file instances.
213 @sa file_lost.
214 */
216 /**
217 Maximum number of instrumented file handles.
218 @sa file_handle_lost.
219 */
221 /**
222 Maximum number of instrumented socket instances
223 @sa socket_lost
224 */
226 /**
227 Maximum number of instrumented socket classes.
228 @sa socket_class_lost.
229 */
231 /** Maximum number of rows per thread in table EVENTS_WAITS_HISTORY. */
233 /** Maximum number of rows in table EVENTS_WAITS_HISTORY_LONG. */
235 /** Maximum number of rows in table SETUP_ACTORS. */
237 /** Maximum number of rows in table SETUP_OBJECTS. */
239 /** Maximum number of rows in table HOSTS. */
241 /** Maximum number of rows in table USERS. */
243 /** Maximum number of rows in table ACCOUNTS. */
245 /**
246 Maximum number of instrumented stage classes.
247 @sa stage_class_lost.
248 */
250 /** Maximum number of rows per thread in table EVENTS_STAGES_HISTORY. */
252 /** Maximum number of rows in table EVENTS_STAGES_HISTORY_LONG. */
254 /**
255 Maximum number of instrumented statement classes.
256 @sa statement_class_lost.
257 */
259 /** Maximum number of rows per thread in table EVENTS_STATEMENTS_HISTORY. */
261 /** Maximum number of rows in table EVENTS_STATEMENTS_HISTORY_LONG. */
263 /** Maximum number of digests to be captured */
265 /** Maximum number of programs to be captured */
267 /** Maximum number of prepared statements to be captured */
269 /** Maximum number of rows per thread in table EVENTS_TRANSACTIONS_HISTORY. */
271 /** Maximum number of rows in table EVENTS_TRANSACTIONS_HISTORY_LONG. */
273
274 /** Maximum number of session attribute strings per thread */
276 /** Maximum size of statement stack */
278
279 /**
280 Maximum number of instrumented memory classes.
281 @sa memory_class_lost.
282 */
284
285 /**
286 Maximum number of instrumented meter classes.
287 @sa meter_class_lost.
288 */
290
291 /**
292 Maximum number of instrumented metric classes.
293 @sa metric_class_lost.
294 */
296
298
301
302 /** Maximum age in seconds for a query sample. */
304
305 /** Maximum number of error instrumented */
307
308 /** Sizing hints, for auto tuning. */
310};
311
312/**
313 Performance schema sizing values for the server.
314 This global variable is set when parsing server startup options.
315*/
317
318/**
319 Null initialization.
320 Disable all instrumentation, size all internal buffers to 0.
321 This pre initialization step is needed to ensure that events can be collected
322 and discarded, until such time @c initialize_performance_schema() is called.
323*/
325
326/**
327 Initialize the performance schema.
328 The performance schema implement several instrumentation services.
329 Each instrumentation service is versioned, and accessible through
330 a bootstrap structure, returned as output parameter.
331 @param param Size parameters to use.
332 @param [out] thread_bootstrap Thread instrumentation service bootstrap
333 @param [out] mutex_bootstrap Mutex instrumentation service bootstrap
334 @param [out] rwlock_bootstrap Rwlock instrumentation service bootstrap
335 @param [out] cond_bootstrap Condition instrumentation service bootstrap
336 @param [out] file_bootstrap File instrumentation service bootstrap
337 @param [out] socket_bootstrap Socket instrumentation service bootstrap
338 @param [out] table_bootstrap Table instrumentation service bootstrap
339 @param [out] mdl_bootstrap Metadata Lock instrumentation service bootstrap
340 @param [out] idle_bootstrap Idle instrumentation service bootstrap
341 @param [out] stage_bootstrap Stage instrumentation service bootstrap
342 @param [out] statement_bootstrap Statement instrumentation service bootstrap
343 @param [out] transaction_bootstrap Transaction instrumentation service
344 bootstrap
345 @param [out] memory_bootstrap Memory instrumentation service bootstrap
346 @param [out] error_bootstrap Error instrumentation service bootstrap
347 @param [out] data_lock_bootstrap Data Lock instrumentation service bootstrap
348 @param [out] system_bootstrap System instrumentation service bootstrap
349 @param [out] tls_channel_bootstrap TLS channel instrumentation service
350 bootstrap
351 @retval 0 success
352*/
354 PFS_global_param *param, PSI_thread_bootstrap **thread_bootstrap,
355 PSI_mutex_bootstrap **mutex_bootstrap,
356 PSI_rwlock_bootstrap **rwlock_bootstrap,
357 PSI_cond_bootstrap **cond_bootstrap, PSI_file_bootstrap **file_bootstrap,
358 PSI_socket_bootstrap **socket_bootstrap,
359 PSI_table_bootstrap **table_bootstrap, PSI_mdl_bootstrap **mdl_bootstrap,
360 PSI_idle_bootstrap **idle_bootstrap, PSI_stage_bootstrap **stage_bootstrap,
361 PSI_statement_bootstrap **statement_bootstrap,
362 PSI_transaction_bootstrap **transaction_bootstrap,
363 PSI_memory_bootstrap **memory_bootstrap,
364 PSI_error_bootstrap **error_bootstrap,
365 PSI_data_lock_bootstrap **data_lock_bootstrap,
366 PSI_system_bootstrap **system_bootstrap,
367 PSI_tls_channel_bootstrap **tls_channel_bootstrap);
368
370
371/**
372 Initialize the performance schema ACL.
373 ACL is strictly enforced when the server is running in normal mode,
374 to enforce that only legal operations are allowed.
375 When running in bootstrap mode, ACL restrictions are relaxed,
376 to allow the bootstrap scripts to DROP / CREATE performance schema tables.
377 @sa ACL_internal_schema_registry
378 @param bootstrap True if the server is starting in bootstrap mode.
379*/
381
382/**
383 Reset the aggregated status counter stats.
384*/
386
387/**
388 Initialize the dynamic array holding individual instrument settings collected
389 from the server configuration options.
390*/
392
393/**
394 Process one PFS_INSTRUMENT configuration string.
395*/
396int add_pfs_instr_to_array(const char *name, const char *value);
397
398/**
399 Shutdown the performance schema.
400*/
402
403#endif /* HAVE_PSI_INTERFACE */
404
405#endif /* PFS_SERVER_H */
void initialize_performance_schema_acl(bool bootstrap)
Initialize the performance schema ACL.
Definition: pfs_engine_table.cc:1000
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
Definition: bootstrap.cc:71
void reset_pfs_status_stats()
Reset the aggregated status counter stats.
Definition: pfs_variable.cc:1560
void shutdown_performance_schema()
Shutdown the performance schema.
Definition: pfs_server.cc:384
void init_pfs_instrument_array()
Initialize the dynamic array holding individual instrument settings collected from the server configu...
Definition: pfs_server.cc:419
void pfs_automated_sizing(PFS_global_param *param)
Definition: pfs_autosize.cc:159
void pre_initialize_performance_schema()
Null initialization.
Definition: pfs_server.cc:73
int add_pfs_instr_to_array(const char *name, const char *value)
Process one PFS_INSTRUMENT configuration string.
Definition: pfs_server.cc:444
PFS_global_param pfs_param
Performance schema sizing values for the server.
Definition: pfs_server.cc:66
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)
Initialize the performance schema.
Definition: pfs_server.cc:96
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
case opt name
Definition: sslopt-case.h:29
Performance schema global sizing parameters.
Definition: pfs_server.h:119
long m_events_stages_history_long_sizing
Maximum number of rows in table EVENTS_STAGES_HISTORY_LONG.
Definition: pfs_server.h:253
ulong m_memory_class_sizing
Maximum number of instrumented memory classes.
Definition: pfs_server.h:283
long m_socket_sizing
Maximum number of instrumented socket instances.
Definition: pfs_server.h:225
long m_session_connect_attrs_sizing
Maximum number of session attribute strings per thread.
Definition: pfs_server.h:275
ulong m_metric_class_sizing
Maximum number of instrumented metric classes.
Definition: pfs_server.h:295
long m_events_transactions_history_long_sizing
Maximum number of rows in table EVENTS_TRANSACTIONS_HISTORY_LONG.
Definition: pfs_server.h:272
bool m_consumer_events_stages_history_enabled
Definition: pfs_server.h:124
ulong m_max_digest_sample_age
Maximum age in seconds for a query sample.
Definition: pfs_server.h:303
long m_account_sizing
Maximum number of rows in table ACCOUNTS.
Definition: pfs_server.h:244
long m_user_sizing
Maximum number of rows in table USERS.
Definition: pfs_server.h:242
long m_events_waits_history_long_sizing
Maximum number of rows in table EVENTS_WAITS_HISTORY_LONG.
Definition: pfs_server.h:234
long m_index_stat_sizing
Maximum number of index statistics collected for tables.
Definition: pfs_server.h:180
long m_prepared_stmt_sizing
Maximum number of prepared statements to be captured.
Definition: pfs_server.h:268
bool m_consumer_events_transactions_history_enabled
Definition: pfs_server.h:131
bool m_consumer_thread_instrumentation_enabled
Definition: pfs_server.h:137
long m_events_stages_history_sizing
Maximum number of rows per thread in table EVENTS_STAGES_HISTORY.
Definition: pfs_server.h:251
bool m_consumer_events_statements_history_enabled
Definition: pfs_server.h:128
bool m_consumer_events_stages_current_enabled
Default values for SETUP_CONSUMERS.
Definition: pfs_server.h:123
bool m_consumer_events_waits_current_enabled
Definition: pfs_server.h:133
long m_table_share_sizing
Maximum number of instrumented table share.
Definition: pfs_server.h:170
long m_digest_sizing
Maximum number of digests to be captured.
Definition: pfs_server.h:264
bool m_consumer_events_statements_current_enabled
Definition: pfs_server.h:127
ulong m_mutex_class_sizing
Maximum number of instrumented mutex classes.
Definition: pfs_server.h:150
long m_program_sizing
Maximum number of programs to be captured.
Definition: pfs_server.h:266
bool m_consumer_events_transactions_history_long_enabled
Definition: pfs_server.h:132
ulong m_meter_class_sizing
Maximum number of instrumented meter classes.
Definition: pfs_server.h:289
bool m_consumer_events_stages_history_long_enabled
Definition: pfs_server.h:125
long m_file_sizing
Maximum number of instrumented file instances.
Definition: pfs_server.h:215
long m_events_statements_history_long_sizing
Maximum number of rows in table EVENTS_STATEMENTS_HISTORY_LONG.
Definition: pfs_server.h:262
ulong m_socket_class_sizing
Maximum number of instrumented socket classes.
Definition: pfs_server.h:230
long m_rwlock_sizing
Maximum number of instrumented rwlock instances.
Definition: pfs_server.h:195
bool m_consumer_events_statements_history_long_enabled
Definition: pfs_server.h:129
long m_file_handle_sizing
Maximum number of instrumented file handles.
Definition: pfs_server.h:220
bool m_enabled
True if the performance schema is enabled.
Definition: pfs_server.h:121
ulong m_file_class_sizing
Maximum number of instrumented file classes.
Definition: pfs_server.h:185
long m_metadata_lock_sizing
Definition: pfs_server.h:297
long m_setup_object_sizing
Maximum number of rows in table SETUP_OBJECTS.
Definition: pfs_server.h:238
ulong m_rwlock_class_sizing
Maximum number of instrumented rwlock classes.
Definition: pfs_server.h:155
long m_events_waits_history_sizing
Maximum number of rows per thread in table EVENTS_WAITS_HISTORY.
Definition: pfs_server.h:232
ulong m_max_sql_text_length
Definition: pfs_server.h:300
long m_events_transactions_history_sizing
Maximum number of rows per thread in table EVENTS_TRANSACTIONS_HISTORY.
Definition: pfs_server.h:270
bool m_consumer_events_waits_history_long_enabled
Definition: pfs_server.h:135
bool m_consumer_events_statements_cpu_enabled
Definition: pfs_server.h:126
long m_cond_sizing
Maximum number of instrumented cond instances.
Definition: pfs_server.h:200
long m_max_digest_length
Definition: pfs_server.h:299
PFS_sizing_hints m_hints
Sizing hints, for auto tuning.
Definition: pfs_server.h:309
ulong m_thread_class_sizing
Maximum number of instrumented thread classes.
Definition: pfs_server.h:165
ulong m_error_sizing
Maximum number of error instrumented.
Definition: pfs_server.h:306
ulong m_statement_class_sizing
Maximum number of instrumented statement classes.
Definition: pfs_server.h:258
long m_mutex_sizing
Maximum number of instrumented mutex instances.
Definition: pfs_server.h:190
bool m_consumer_events_waits_history_enabled
Definition: pfs_server.h:134
ulong m_statement_stack_sizing
Maximum size of statement stack.
Definition: pfs_server.h:277
bool m_processlist_enabled
True if SHOW PROCESSLIST is enabeld in the performance schema.
Definition: pfs_server.h:141
char * m_pfs_instrument
Default instrument configuration option.
Definition: pfs_server.h:144
long m_setup_actor_sizing
Maximum number of rows in table SETUP_ACTORS.
Definition: pfs_server.h:236
long m_events_statements_history_sizing
Maximum number of rows per thread in table EVENTS_STATEMENTS_HISTORY.
Definition: pfs_server.h:260
long m_table_lock_stat_sizing
Maximum number of lock statistics collected for tables.
Definition: pfs_server.h:175
long m_thread_sizing
Maximum number of instrumented thread instances.
Definition: pfs_server.h:205
long m_host_sizing
Maximum number of rows in table HOSTS.
Definition: pfs_server.h:240
ulong m_stage_class_sizing
Maximum number of instrumented stage classes.
Definition: pfs_server.h:249
long m_table_sizing
Maximum number of instrumented table handles.
Definition: pfs_server.h:210
bool m_consumer_global_instrumentation_enabled
Definition: pfs_server.h:136
bool m_consumer_events_transactions_current_enabled
Definition: pfs_server.h:130
ulong m_cond_class_sizing
Maximum number of instrumented cond classes.
Definition: pfs_server.h:160
bool m_consumer_statement_digest_enabled
Definition: pfs_server.h:138
Sizing hints, from the server configuration.
Definition: pfs_server.h:105
ulong m_table_definition_cache
Value of Sys_table_def_size.
Definition: pfs_server.h:107
ulong m_max_connections
Value of Sys_max_connections.
Definition: pfs_server.h:111
ulong m_table_open_cache
Value of Sys_table_cache_size.
Definition: pfs_server.h:109
long m_max_prepared_stmt_count
Value of Sys_max_prepared_stmt_count.
Definition: pfs_server.h:115
long m_open_files_limit
Value of Sys_open_files_limit.
Definition: pfs_server.h:113
Entry point for the performance schema interface.
Definition: psi_cond.h:46
Entry point for the performance schema interface.
Definition: psi_data_lock.h:82
Entry point for the performance schema interface.
Definition: psi_error.h:59
Entry point for the performance schema interface.
Definition: psi_file.h:66
Entry point for the performance schema interface.
Definition: psi_idle.h:60
Entry point for the performance schema interface.
Definition: psi_mdl.h:68
Entry point for the performance schema interface.
Definition: psi_memory.h:85
Entry point for the performance schema interface.
Definition: psi_mutex.h:46
Entry point for the performance schema interface.
Definition: psi_rwlock.h:53
Entry point for the performance schema interface.
Definition: psi_socket.h:52
Entry point for the performance schema interface.
Definition: psi_stage.h:46
Entry point for the performance schema interface.
Definition: psi_statement.h:46
Entry point for the performance schema interface.
Definition: psi_system.h:60
Entry point for the performance schema interface.
Definition: psi_table.h:60
Entry point for the performance schema interface.
Definition: psi_thread.h:102
Entry point for the performance schema interface.
Definition: psi_tls_channel.h:46
Entry point for the performance schema interface.
Definition: psi_transaction.h:60