MySQL 8.0.29
Source Code Documentation
table_threads.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef TABLE_THREADS_H
24#define TABLE_THREADS_H
25
26/**
27 @file storage/perfschema/table_threads.h
28 TABLE THREADS.
29*/
30
31#include <sys/types.h>
32#include <time.h>
33
34#include "my_inttypes.h"
37
38struct PFS_thread;
39
40/**
41 @addtogroup performance_schema_tables
42 @{
43*/
44
45/**
46 A row of PERFORMANCE_SCHEMA.THREADS.
47*/
49 /** Column THREAD_ID. */
51 /** Column PROCESSLIST_ID. */
53 /** Column NAME. */
54 const char *m_name;
55 /** Length in bytes of @c m_name. */
57 /** Column PROCESSLIST_USER. */
59 /** Column PROCESSLIST_HOST. */
61 /** Column PROCESSLIST_DB. */
63 /** Column PROCESSLIST_COMMAND. */
65 /** Column PROCESSLIST_TIME. */
67 /** Column PROCESSLIST_STATE. */
69 /** Length in bytes of @c m_processlist_state_ptr. */
71 /** Column PROCESSLIST_INFO. */
73 /** Length in bytes of @c m_processlist_info_ptr. */
75 /** Column INSTRUMENTED (read). */
77 /** Column HISTORY (read). */
79 /** INSTRUMENTED and HISTORY (write). */
81 /** Column PARENT_THREAD_ID. */
83 /** Column CONNECTION_TYPE. */
85 /** Column THREAD_OS_ID. */
87 /** Column RESOURCE_GROUP. */
89 /** Length in bytes of @c m_groupname. */
91 /** Column EXECUTION_ENGINE. */
93};
94
96 public:
98 : PFS_index_threads(&m_key), m_key("THREAD_ID") {}
99
101
102 bool match(PFS_thread *pfs) override;
103
104 private:
106};
107
109 public:
111 : PFS_index_threads(&m_key), m_key("PROCESSLIST_ID") {}
112
114
115 bool match(PFS_thread *pfs) override;
116
117 private:
119};
120
122 public:
124
125 ~PFS_index_threads_by_name() override = default;
126
127 bool match(PFS_thread *pfs) override;
128
129 private:
131};
132
134 public:
137 m_key_1("PROCESSLIST_USER"),
138 m_key_2("PROCESSLIST_HOST") {}
139
141
142 bool match(PFS_thread *pfs) override;
143
144 private:
147};
148
150 public:
152 : PFS_index_threads(&m_key), m_key("PROCESSLIST_HOST") {}
153
154 ~PFS_index_threads_by_host() override = default;
155
156 bool match(PFS_thread *pfs) override;
157
158 private:
160};
161
163 public:
165 : PFS_index_threads(&m_key), m_key("THREAD_OS_ID") {}
166
168
169 bool match(PFS_thread *pfs) override;
170
171 private:
173};
174
176 public:
178 : PFS_index_threads(&m_key), m_key("RESOURCE_GROUP") {}
179
181
182 bool match(PFS_thread *pfs) override;
183
184 private:
186};
187
188/** Table PERFORMANCE_SCHEMA.THREADS. */
190 public:
191 /** Table share */
193 /** Table builder */
195
196 protected:
197 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
198 bool read_all) override;
199
200 int update_row_values(TABLE *table, const unsigned char *old_buf,
201 unsigned char *new_buf, Field **fields) override;
202
203 protected:
205 int index_init(uint idx, bool sorted) override;
206
207 public:
208 ~table_threads() override = default;
209
210 private:
211 int make_row(PFS_thread *pfs) override;
212
213 /** Table share lock. */
215 /** Table definition. */
217
218 /** Current row. */
220};
221
222/** @} */
223#endif
Definition: field.h:573
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_threads.h:149
~PFS_index_threads_by_host() override=default
PFS_key_host m_key
Definition: table_threads.h:159
PFS_index_threads_by_host()
Definition: table_threads.h:151
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:152
Definition: table_threads.h:121
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:126
PFS_key_thread_name m_key
Definition: table_threads.h:130
~PFS_index_threads_by_name() override=default
PFS_index_threads_by_name()
Definition: table_threads.h:123
Definition: table_threads.h:108
~PFS_index_threads_by_processlist_id() override=default
PFS_index_threads_by_processlist_id()
Definition: table_threads.h:110
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:116
PFS_key_processlist_id m_key
Definition: table_threads.h:118
Definition: table_threads.h:175
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:172
PFS_key_group_name m_key
Definition: table_threads.h:185
~PFS_index_threads_by_resource_group() override=default
PFS_index_threads_by_resource_group()
Definition: table_threads.h:177
Definition: table_threads.h:95
PFS_key_thread_id m_key
Definition: table_threads.h:105
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:106
~PFS_index_threads_by_thread_id() override=default
PFS_index_threads_by_thread_id()
Definition: table_threads.h:97
Definition: table_threads.h:162
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:162
PFS_index_threads_by_thread_os_id()
Definition: table_threads.h:164
~PFS_index_threads_by_thread_os_id() override=default
PFS_key_thread_os_id m_key
Definition: table_threads.h:172
Definition: table_threads.h:133
bool match(PFS_thread *pfs) override
Definition: table_threads.cc:136
PFS_index_threads_by_user_host()
Definition: table_threads.h:135
~PFS_index_threads_by_user_host() override=default
PFS_key_host m_key_2
Definition: table_threads.h:146
PFS_key_user m_key_1
Definition: table_threads.h:145
Definition: cursor_by_thread.h:41
Definition: table_helper.h:1520
Definition: table_helper.h:1458
Definition: table_helper.h:1280
Definition: table_helper.h:1250
Definition: table_helper.h:1421
Definition: table_helper.h:1299
Definition: table_helper.h:1446
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Cursor CURSOR_BY_THREAD.
Definition: cursor_by_thread.h:54
Table PERFORMANCE_SCHEMA.THREADS.
Definition: table_threads.h:189
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_threads.cc:332
row_threads m_row
Current row.
Definition: table_threads.h:219
int index_init(uint idx, bool sorted) override
Definition: table_threads.cc:182
static PFS_engine_table_share m_share
Table share.
Definition: table_threads.h:192
int make_row(PFS_thread *pfs) override
Definition: table_threads.cc:216
static PFS_engine_table * create(PFS_engine_table_share *)
Table builder.
Definition: table_threads.cc:100
table_threads()
Definition: table_threads.cc:104
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:474
static THR_LOCK m_table_lock
Table share lock.
Definition: table_threads.h:214
static Plugin_table m_table_def
Table definition.
Definition: table_threads.h:216
~table_threads() override=default
Cursor CURSOR_BY_THREAD (declarations).
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
unsigned long long my_thread_os_id_t
Definition: my_thread_os_id.h:47
#define NAME_LEN
Definition: mysql_com.h:66
Definition: buf0block_hint.cc:29
Data types for columns used in the performance schema tables (declarations)
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Definition: pfs_name.h:241
Definition: pfs_name.h:113
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: pfs_name.h:220
Definition: table.h:1394
Definition: thr_lock.h:138
A row of PERFORMANCE_SCHEMA.THREADS.
Definition: table_threads.h:48
uint m_groupname_length
Length in bytes of m_groupname.
Definition: table_threads.h:90
const char * m_name
Column NAME.
Definition: table_threads.h:54
ulonglong m_processlist_id
Column PROCESSLIST_ID.
Definition: table_threads.h:52
char m_groupname[NAME_LEN]
Column RESOURCE_GROUP.
Definition: table_threads.h:88
const char * m_processlist_info_ptr
Column PROCESSLIST_INFO.
Definition: table_threads.h:72
PFS_thread * m_psi
INSTRUMENTED and HISTORY (write).
Definition: table_threads.h:80
uint m_processlist_state_length
Length in bytes of m_processlist_state_ptr.
Definition: table_threads.h:70
bool m_history
Column HISTORY (read).
Definition: table_threads.h:78
ulonglong m_parent_thread_internal_id
Column PARENT_THREAD_ID.
Definition: table_threads.h:82
my_thread_os_id_t m_thread_os_id
Column THREAD_OS_ID.
Definition: table_threads.h:86
PFS_schema_name m_db_name
Column PROCESSLIST_DB.
Definition: table_threads.h:62
uint m_processlist_info_length
Length in bytes of m_processlist_info_ptr.
Definition: table_threads.h:74
bool m_secondary
Column EXECUTION_ENGINE.
Definition: table_threads.h:92
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_threads.h:50
bool m_enabled
Column INSTRUMENTED (read).
Definition: table_threads.h:76
time_t m_start_time
Column PROCESSLIST_TIME.
Definition: table_threads.h:66
int m_command
Column PROCESSLIST_COMMAND.
Definition: table_threads.h:64
enum_vio_type m_connection_type
Column CONNECTION_TYPE.
Definition: table_threads.h:84
uint m_name_length
Length in bytes of m_name.
Definition: table_threads.h:56
const char * m_processlist_state_ptr
Column PROCESSLIST_STATE.
Definition: table_threads.h:68
PFS_user_name m_user_name
Column PROCESSLIST_USER.
Definition: table_threads.h:58
PFS_host_name m_host_name
Column PROCESSLIST_HOST.
Definition: table_threads.h:60
Include file for Sun RPC to compile out of the box.
unsigned int uint
Definition: uca-dump.cc:29
enum_vio_type
Definition: violite.h:77