MySQL 8.0.39
Source Code Documentation
table_threads.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 TABLE_THREADS_H
25#define TABLE_THREADS_H
26
27/**
28 @file storage/perfschema/table_threads.h
29 TABLE THREADS.
30*/
31
32#include <sys/types.h>
33#include <time.h>
34
35#include "my_inttypes.h"
38
39struct PFS_thread;
40
41/**
42 @addtogroup performance_schema_tables
43 @{
44*/
45
46/**
47 A row of PERFORMANCE_SCHEMA.THREADS.
48*/
50 /** Column THREAD_ID. */
52 /** Column PROCESSLIST_ID. */
54 /** Column NAME. */
55 const char *m_name;
56 /** Length in bytes of @c m_name. */
58 /** Column PROCESSLIST_USER. */
60 /** Column PROCESSLIST_HOST. */
62 /** Column PROCESSLIST_DB. */
64 /** Column PROCESSLIST_COMMAND. */
66 /** Column PROCESSLIST_TIME. */
68 /** Column PROCESSLIST_STATE. */
70 /** Length in bytes of @c m_processlist_state_ptr. */
72 /** Column PROCESSLIST_INFO. */
74 /** Length in bytes of @c m_processlist_info_ptr. */
76 /** Column INSTRUMENTED (read). */
78 /** Column HISTORY (read). */
80 /** INSTRUMENTED and HISTORY (write). */
82 /** Column PARENT_THREAD_ID. */
84 /** Column CONNECTION_TYPE. */
86 /** Column THREAD_OS_ID. */
88 /** Column RESOURCE_GROUP. */
90 /** Length in bytes of @c m_groupname. */
92 /** Column EXECUTION_ENGINE. */
94 /** CURRENT_CONTROLLED_MEMORY, ... */
96 /** Column TELEMETRY_ACTIVE (read). */
98};
99
101 public:
103 : PFS_index_threads(&m_key), m_key("THREAD_ID") {}
104
106
107 bool match(PFS_thread *pfs) override;
108
109 private:
111};
112
114 public:
116 : PFS_index_threads(&m_key), m_key("PROCESSLIST_ID") {}
117
119
120 bool match(PFS_thread *pfs) override;
121
122 private:
124};
125
127 public:
129
130 ~PFS_index_threads_by_name() override = default;
131
132 bool match(PFS_thread *pfs) override;
133
134 private:
136};
137
139 public:
142 m_key_1("PROCESSLIST_USER"),
143 m_key_2("PROCESSLIST_HOST") {}
144
146
147 bool match(PFS_thread *pfs) override;
148
149 private:
152};
153
155 public:
157 : PFS_index_threads(&m_key), m_key("PROCESSLIST_HOST") {}
158
159 ~PFS_index_threads_by_host() override = default;
160
161 bool match(PFS_thread *pfs) override;
162
163 private:
165};
166
168 public:
170 : PFS_index_threads(&m_key), m_key("THREAD_OS_ID") {}
171
173
174 bool match(PFS_thread *pfs) override;
175
176 private:
178};
179
181 public:
183 : PFS_index_threads(&m_key), m_key("RESOURCE_GROUP") {}
184
186
187 bool match(PFS_thread *pfs) override;
188
189 private:
191};
192
193/** Table PERFORMANCE_SCHEMA.THREADS. */
195 public:
196 /** Table share */
198 /** Table builder */
200
201 protected:
202 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
203 bool read_all) override;
204
205 int update_row_values(TABLE *table, const unsigned char *old_buf,
206 unsigned char *new_buf, Field **fields) override;
207
208 protected:
210 int index_init(uint idx, bool sorted) override;
211
212 public:
213 ~table_threads() override = default;
214
215 private:
216 int make_row(PFS_thread *pfs) override;
217
218 /** Table share lock. */
220 /** Table definition. */
222
223 /** Current row. */
225};
226
227/** @} */
228#endif
Definition: field.h:575
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_threads.h:154
~PFS_index_threads_by_host() override=default
PFS_key_host m_key
Definition: table_threads.h:164
PFS_index_threads_by_host()
Definition: table_threads.h:156
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:158
Definition: table_threads.h:126
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:132
PFS_key_thread_name m_key
Definition: table_threads.h:135
~PFS_index_threads_by_name() override=default
PFS_index_threads_by_name()
Definition: table_threads.h:128
Definition: table_threads.h:113
~PFS_index_threads_by_processlist_id() override=default
PFS_index_threads_by_processlist_id()
Definition: table_threads.h:115
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:122
PFS_key_processlist_id m_key
Definition: table_threads.h:123
Definition: table_threads.h:180
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:178
PFS_key_group_name m_key
Definition: table_threads.h:190
~PFS_index_threads_by_resource_group() override=default
PFS_index_threads_by_resource_group()
Definition: table_threads.h:182
Definition: table_threads.h:100
PFS_key_thread_id m_key
Definition: table_threads.h:110
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:112
~PFS_index_threads_by_thread_id() override=default
PFS_index_threads_by_thread_id()
Definition: table_threads.h:102
Definition: table_threads.h:167
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:168
PFS_index_threads_by_thread_os_id()
Definition: table_threads.h:169
~PFS_index_threads_by_thread_os_id() override=default
PFS_key_thread_os_id m_key
Definition: table_threads.h:177
Definition: table_threads.h:138
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:142
PFS_index_threads_by_user_host()
Definition: table_threads.h:140
~PFS_index_threads_by_user_host() override=default
PFS_key_host m_key_2
Definition: table_threads.h:151
PFS_key_user m_key_1
Definition: table_threads.h:150
Definition: cursor_by_thread.h:42
Definition: table_helper.h:1547
Definition: table_helper.h:1485
Definition: table_helper.h:1308
Definition: table_helper.h:1278
Definition: table_helper.h:1448
Definition: table_helper.h:1327
Definition: table_helper.h:1473
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Cursor CURSOR_BY_THREAD.
Definition: cursor_by_thread.h:55
Table PERFORMANCE_SCHEMA.THREADS.
Definition: table_threads.h:194
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_threads.cc:342
row_threads m_row
Current row.
Definition: table_threads.h:224
int index_init(uint idx, bool sorted) override
Definition: table_threads.cc:188
static PFS_engine_table_share m_share
Table share.
Definition: table_threads.h:197
int make_row(PFS_thread *pfs) override
Definition: table_threads.cc:222
static PFS_engine_table * create(PFS_engine_table_share *)
Table builder.
Definition: table_threads.cc:106
table_threads()
Definition: table_threads.cc:110
int update_row_values(TABLE *table, const unsigned char *old_buf, unsigned char *new_buf, Field **fields) override
Update the current row values.
Definition: table_threads.cc:493
static THR_LOCK m_table_lock
Table share lock.
Definition: table_threads.h:219
static Plugin_table m_table_def
Table definition.
Definition: table_threads.h:221
~table_threads() override=default
Cursor CURSOR_BY_THREAD (declarations).
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned long long my_thread_os_id_t
Definition: my_thread_os_id.h:48
#define NAME_LEN
Definition: mysql_com.h:67
Definition: buf0block_hint.cc:30
Data types for columns used in the performance schema tables (declarations)
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Definition: pfs_name.h:514
Definition: pfs_name.h:186
Definition: table_helper.h:1101
Instrumented thread implementation.
Definition: pfs_instr.h:373
Definition: pfs_name.h:470
Definition: table.h:1399
Definition: thr_lock.h:139
A row of PERFORMANCE_SCHEMA.THREADS.
Definition: table_threads.h:49
uint m_groupname_length
Length in bytes of m_groupname.
Definition: table_threads.h:91
const char * m_name
Column NAME.
Definition: table_threads.h:55
ulonglong m_processlist_id
Column PROCESSLIST_ID.
Definition: table_threads.h:53
char m_groupname[NAME_LEN]
Column RESOURCE_GROUP.
Definition: table_threads.h:89
const char * m_processlist_info_ptr
Column PROCESSLIST_INFO.
Definition: table_threads.h:73
PFS_session_all_memory_stat_row m_session_all_memory_row
CURRENT_CONTROLLED_MEMORY, ...
Definition: table_threads.h:95
PFS_thread * m_psi
INSTRUMENTED and HISTORY (write).
Definition: table_threads.h:81
bool m_telemetry_active
Column TELEMETRY_ACTIVE (read).
Definition: table_threads.h:97
uint m_processlist_state_length
Length in bytes of m_processlist_state_ptr.
Definition: table_threads.h:71
bool m_history
Column HISTORY (read).
Definition: table_threads.h:79
ulonglong m_parent_thread_internal_id
Column PARENT_THREAD_ID.
Definition: table_threads.h:83
my_thread_os_id_t m_thread_os_id
Column THREAD_OS_ID.
Definition: table_threads.h:87
PFS_schema_name m_db_name
Column PROCESSLIST_DB.
Definition: table_threads.h:63
uint m_processlist_info_length
Length in bytes of m_processlist_info_ptr.
Definition: table_threads.h:75
bool m_secondary
Column EXECUTION_ENGINE.
Definition: table_threads.h:93
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_threads.h:51
bool m_enabled
Column INSTRUMENTED (read).
Definition: table_threads.h:77
time_t m_start_time
Column PROCESSLIST_TIME.
Definition: table_threads.h:67
int m_command
Column PROCESSLIST_COMMAND.
Definition: table_threads.h:65
enum_vio_type m_connection_type
Column CONNECTION_TYPE.
Definition: table_threads.h:85
uint m_name_length
Length in bytes of m_name.
Definition: table_threads.h:57
const char * m_processlist_state_ptr
Column PROCESSLIST_STATE.
Definition: table_threads.h:69
PFS_user_name m_user_name
Column PROCESSLIST_USER.
Definition: table_threads.h:59
PFS_host_name m_host_name
Column PROCESSLIST_HOST.
Definition: table_threads.h:61
Include file for Sun RPC to compile out of the box.
unsigned int uint
Definition: uca9-dump.cc:75
enum_vio_type
Definition: violite.h:79