MySQL 9.1.0
Source Code Documentation
table_table_handles.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 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_TABLE_HANDLES_H
25#define TABLE_TABLE_HANDLES_H
26
27/**
28 @file storage/perfschema/table_table_handles.h
29 Table TABLE_HANDLES (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
39
40class Field;
41class Plugin_table;
42struct PFS_table;
43struct TABLE;
44struct THR_LOCK;
45
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
51/**
52 A row of table
53 PERFORMANCE_SCHEMA.TABLE_HANDLES.
54*/
56 /** Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME. */
58 /** Column OBJECT_INSTANCE_BEGIN. */
59 const void *m_identity;
60 /** Column OWNER_THREAD_ID. */
62 /** Column OWNER_EVENT_ID. */
64 /** Column INTERNAL_LOCK. */
66 /** Column EXTERNAL_LOCK. */
68};
69
71 public:
73 : PFS_engine_index(key_1) {}
74
76 : PFS_engine_index(key_1, key_2) {}
77
79 PFS_engine_key *key_3)
80 : PFS_engine_index(key_1, key_2, key_3) {}
81
82 ~PFS_index_table_handles() override = default;
83
84 virtual bool match(PFS_table *table) = 0;
85};
86
88 public:
91 m_key_1("OBJECT_TYPE"),
92 m_key_2("OBJECT_SCHEMA"),
93 m_key_3("OBJECT_NAME") {}
94
96
97 bool match(PFS_table *pfs) override;
98
99 private:
103};
104
106 public:
108 : PFS_index_table_handles(&m_key), m_key("OBJECT_INSTANCE_BEGIN") {}
109
111
112 bool match(PFS_table *pfs) override;
113
114 private:
116};
117
119 public:
122 m_key_1("OWNER_THREAD_ID"),
123 m_key_2("OWNER_EVENT_ID") {}
124
126
127 bool match(PFS_table *pfs) override;
128
129 private:
132};
133
134/** Table PERFORMANCE_SCHEMA.TABLE_HANDLES. */
136 public:
137 /** Table share */
140 static ha_rows get_row_count();
141
142 void reset_position() override;
143
144 int rnd_init(bool scan) override;
145 int rnd_next() override;
146 int rnd_pos(const void *pos) override;
147
148 int index_init(uint idx, bool sorted) override;
149 int index_next() override;
150
151 protected:
152 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
153 bool read_all) override;
155
156 public:
157 ~table_table_handles() override = default;
158
159 protected:
161
162 private:
163 /** Table share lock. */
165 /** Table definition. */
167
168 /** Current row. */
170 /** Current position. */
172 /** Next position. */
174
175 protected:
177};
178
179/** @} */
180#endif
Definition: field.h:577
Definition: pfs_engine_table.h:301
Definition: pfs_engine_table.h:268
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_table_handles.h:105
PFS_key_object_instance m_key
Definition: table_table_handles.h:115
bool match(PFS_table *pfs) override
Definition: table_table_handles.cc:111
~PFS_index_table_handles_by_instance() override=default
PFS_index_table_handles_by_instance()
Definition: table_table_handles.h:107
Definition: table_table_handles.h:87
~PFS_index_table_handles_by_object() override=default
PFS_key_object_schema m_key_2
Definition: table_table_handles.h:101
PFS_key_object_type m_key_1
Definition: table_table_handles.h:100
PFS_index_table_handles_by_object()
Definition: table_table_handles.h:89
bool match(PFS_table *pfs) override
Definition: table_table_handles.cc:84
PFS_key_object_name m_key_3
Definition: table_table_handles.h:102
Definition: table_table_handles.h:118
bool match(PFS_table *pfs) override
Definition: table_table_handles.cc:121
PFS_key_event_id m_key_2
Definition: table_table_handles.h:131
PFS_index_table_handles_by_owner()
Definition: table_table_handles.h:120
PFS_key_thread_id m_key_1
Definition: table_table_handles.h:130
~PFS_index_table_handles_by_owner() override=default
Definition: table_table_handles.h:70
PFS_index_table_handles(PFS_engine_key *key_1)
Definition: table_table_handles.h:72
PFS_index_table_handles(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: table_table_handles.h:75
virtual bool match(PFS_table *table)=0
~PFS_index_table_handles() override=default
PFS_index_table_handles(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3)
Definition: table_table_handles.h:78
Definition: table_helper.h:1295
Definition: table_helper.h:1734
Definition: table_helper.h:1671
Definition: table_helper.h:1656
Definition: table_helper.h:1696
Definition: table_helper.h:1279
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.TABLE_HANDLES.
Definition: table_table_handles.h:135
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_table_handles.cc:137
int make_row(PFS_table *table)
Definition: table_table_handles.cc:229
row_table_handles m_row
Current row.
Definition: table_table_handles.h:169
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_table_handles.cc:156
static ha_rows get_row_count()
Definition: table_table_handles.cc:141
static PFS_engine_table_share m_share
Table share.
Definition: table_table_handles.h:138
PFS_simple_index m_next_pos
Next position.
Definition: table_table_handles.h:173
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_table_handles.cc:158
static Plugin_table m_table_def
Table definition.
Definition: table_table_handles.h:166
PFS_simple_index m_pos
Current position.
Definition: table_table_handles.h:171
PFS_index_table_handles * m_opened_index
Definition: table_table_handles.h:176
static THR_LOCK m_table_lock
Table share lock.
Definition: table_table_handles.h:164
int index_init(uint idx, bool sorted) override
Definition: table_table_handles.cc:185
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_table_handles.cc:172
table_table_handles()
Definition: table_table_handles.cc:145
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_table_handles.cc:266
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_table_handles.cc:151
~table_table_handles() override=default
int index_next() override
Find key in index, read record.
Definition: table_table_handles.cc:208
PFS_TL_LOCK_TYPE
Definition: pfs_stat.h:689
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
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
Statistics (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:359
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_helper.h:603
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:567
Instrumented table implementation.
Definition: pfs_instr.h:195
Definition: table.h:1421
Definition: thr_lock.h:139
A row of table PERFORMANCE_SCHEMA.TABLE_HANDLES.
Definition: table_table_handles.h:55
PFS_TL_LOCK_TYPE m_external_lock
Column EXTERNAL_LOCK.
Definition: table_table_handles.h:67
ulonglong m_owner_thread_id
Column OWNER_THREAD_ID.
Definition: table_table_handles.h:61
PFS_object_row m_object
Column OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME.
Definition: table_table_handles.h:57
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: table_table_handles.h:59
PFS_TL_LOCK_TYPE m_internal_lock
Column INTERNAL_LOCK.
Definition: table_table_handles.h:65
ulonglong m_owner_event_id
Column OWNER_EVENT_ID.
Definition: table_table_handles.h:63
Helpers to implement a performance schema table.