MySQL 8.0.39
Source Code Documentation
table_md_locks.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_METADATA_LOCK_H
25#define TABLE_METADATA_LOCK_H
26
27/**
28 @file storage/perfschema/table_md_locks.h
29 Table METADATA_LOCKS (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
39
40class Field;
41class Plugin_table;
43struct TABLE;
44struct THR_LOCK;
45
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
51/** A row of table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */
53 /** Column OBJECT_INSTANCE_BEGIN. */
54 const void *m_identity;
58 /** Column SOURCE. */
60 /** Length in bytes of @c m_source. */
62 /** Column OWNER_THREAD_ID. */
64 /** Column OWNER_EVENT_ID. */
66 /** Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COLUMN_NAME. */
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, PFS_engine_key *key_4)
80 : PFS_engine_index(key_1, key_2, key_3, key_4) {}
81
82 ~PFS_index_metadata_locks() override = default;
83
84 virtual bool match(const PFS_metadata_lock *pfs) = 0;
85};
86
88 public:
90 : PFS_index_metadata_locks(&m_key), m_key("OBJECT_INSTANCE_BEGIN") {}
91
93
94 bool match(const PFS_metadata_lock *pfs) override;
95
96 private:
98};
99
101 public:
104 m_key_1("OBJECT_TYPE"),
105 m_key_2("OBJECT_SCHEMA"),
106 m_key_3("OBJECT_NAME"),
107 m_key_4("COLUMN_NAME") {}
108
110
111 bool match(const PFS_metadata_lock *pfs) override;
112
113 private:
118};
119
121 public:
124 m_key_1("OWNER_THREAD_ID"),
125 m_key_2("OWNER_EVENT_ID") {}
126
128
129 bool match(const PFS_metadata_lock *pfs) override;
130
131 private:
134};
135
136/** Table PERFORMANCE_SCHEMA.METADATA_LOCKS. */
138 public:
139 /** Table share. */
142 static ha_rows get_row_count();
143
144 void reset_position() override;
145
146 int rnd_next() override;
147 int rnd_pos(const void *pos) override;
148
149 int index_init(uint idx, bool sorted) override;
150 int index_next() override;
151
152 private:
153 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
154 bool read_all) override;
156
157 public:
158 ~table_metadata_locks() override = default;
159
160 private:
162
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:575
Definition: pfs_engine_table.h:300
Definition: pfs_engine_table.h:268
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_md_locks.h:87
~PFS_index_metadata_locks_by_instance() override=default
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:87
PFS_key_object_instance m_key
Definition: table_md_locks.h:97
PFS_index_metadata_locks_by_instance()
Definition: table_md_locks.h:89
Definition: table_md_locks.h:100
PFS_key_object_name m_key_3
Definition: table_md_locks.h:116
PFS_key_object_schema m_key_2
Definition: table_md_locks.h:115
PFS_index_metadata_locks_by_object()
Definition: table_md_locks.h:102
PFS_key_column_name m_key_4
Definition: table_md_locks.h:117
~PFS_index_metadata_locks_by_object() override=default
PFS_key_object_type m_key_1
Definition: table_md_locks.h:114
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:97
Definition: table_md_locks.h:120
~PFS_index_metadata_locks_by_owner() override=default
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:131
PFS_index_metadata_locks_by_owner()
Definition: table_md_locks.h:122
PFS_key_thread_id m_key_1
Definition: table_md_locks.h:132
PFS_key_event_id m_key_2
Definition: table_md_locks.h:133
Definition: table_md_locks.h:70
~PFS_index_metadata_locks() override=default
virtual bool match(const PFS_metadata_lock *pfs)=0
PFS_index_metadata_locks(PFS_engine_key *key_1)
Definition: table_md_locks.h:72
PFS_index_metadata_locks(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3, PFS_engine_key *key_4)
Definition: table_md_locks.h:78
PFS_index_metadata_locks(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: table_md_locks.h:75
Definition: table_helper.h:1653
Definition: table_helper.h:1294
Definition: table_helper.h:1700
Definition: table_helper.h:1637
Definition: table_helper.h:1622
Definition: table_helper.h:1662
Definition: table_helper.h:1278
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.METADATA_LOCKS.
Definition: table_md_locks.h:137
static Plugin_table m_table_def
Table definition.
Definition: table_md_locks.h:166
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_md_locks.cc:147
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_md_locks.cc:163
int index_init(uint idx, bool sorted) override
Definition: table_md_locks.cc:190
PFS_index_metadata_locks * m_opened_index
Definition: table_md_locks.h:176
static PFS_engine_table_share m_share
Table share.
Definition: table_md_locks.h:140
static ha_rows get_row_count()
Definition: table_md_locks.cc:151
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_md_locks.cc:262
int index_next() override
Find key in index, read record.
Definition: table_md_locks.cc:213
PFS_simple_index m_pos
Current position.
Definition: table_md_locks.h:171
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_md_locks.cc:177
row_metadata_lock m_row
Current row.
Definition: table_md_locks.h:169
~table_metadata_locks() override=default
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_md_locks.cc:158
int make_row(PFS_metadata_lock *pfs)
Definition: table_md_locks.cc:234
PFS_simple_index m_next_pos
Next position.
Definition: table_md_locks.h:173
table_metadata_locks()
Definition: table_md_locks.cc:155
static THR_LOCK m_table_lock
Table share lock.
Definition: table_md_locks.h:164
int opaque_mdl_duration
Definition: psi_mdl_bits.h:42
int opaque_mdl_status
Definition: psi_mdl_bits.h:45
int opaque_mdl_type
Definition: psi_mdl_bits.h:36
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Definition: buf0block_hint.cc:30
Data types for columns used in the performance schema tables (declarations)
#define COL_SOURCE_SIZE
Size of the SOURCE columns, in bytes.
Definition: pfs_column_types.h:76
Performance schema tables (declarations).
Performance schema instrumentation interface.
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME, COLUMN_NAME.
Definition: table_helper.h:634
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Instrumented metadata lock implementation.
Definition: pfs_instr.h:316
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Definition: table.h:1399
Definition: thr_lock.h:139
A row of table PERFORMANCE_SCHEMA.MUTEX_INSTANCES.
Definition: table_md_locks.h:52
uint m_source_length
Length in bytes of m_source.
Definition: table_md_locks.h:61
ulong m_owner_thread_id
Column OWNER_THREAD_ID.
Definition: table_md_locks.h:63
opaque_mdl_status m_mdl_status
Definition: table_md_locks.h:57
ulong m_owner_event_id
Column OWNER_EVENT_ID.
Definition: table_md_locks.h:65
opaque_mdl_duration m_mdl_duration
Definition: table_md_locks.h:56
PFS_column_row m_object
Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COLUMN_NAME.
Definition: table_md_locks.h:67
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_md_locks.h:59
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: table_md_locks.h:54
opaque_mdl_type m_mdl_type
Definition: table_md_locks.h:55
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca9-dump.cc:75