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