MySQL 8.1.0
Source Code Documentation
table_md_locks.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_METADATA_LOCK_H
24#define TABLE_METADATA_LOCK_H
25
26/**
27 @file storage/perfschema/table_md_locks.h
28 Table METADATA_LOCKS (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
38
39class Field;
40class Plugin_table;
42struct TABLE;
43struct THR_LOCK;
44
45/**
46 @addtogroup performance_schema_tables
47 @{
48*/
49
50/** A row of table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */
52 /** Column OBJECT_INSTANCE_BEGIN. */
53 const void *m_identity;
57 /** Column SOURCE. */
59 /** Length in bytes of @c m_source. */
61 /** Column OWNER_THREAD_ID. */
63 /** Column OWNER_EVENT_ID. */
65 /** Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COLUMN_NAME. */
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, PFS_engine_key *key_4)
79 : PFS_engine_index(key_1, key_2, key_3, key_4) {}
80
81 ~PFS_index_metadata_locks() override = default;
82
83 virtual bool match(const PFS_metadata_lock *pfs) = 0;
84};
85
87 public:
89 : PFS_index_metadata_locks(&m_key), m_key("OBJECT_INSTANCE_BEGIN") {}
90
92
93 bool match(const PFS_metadata_lock *pfs) override;
94
95 private:
97};
98
100 public:
103 m_key_1("OBJECT_TYPE"),
104 m_key_2("OBJECT_SCHEMA"),
105 m_key_3("OBJECT_NAME"),
106 m_key_4("COLUMN_NAME") {}
107
109
110 bool match(const PFS_metadata_lock *pfs) override;
111
112 private:
117};
118
120 public:
123 m_key_1("OWNER_THREAD_ID"),
124 m_key_2("OWNER_EVENT_ID") {}
125
127
128 bool match(const PFS_metadata_lock *pfs) override;
129
130 private:
133};
134
135/** Table PERFORMANCE_SCHEMA.METADATA_LOCKS. */
137 public:
138 /** Table share. */
141 static ha_rows get_row_count();
142
143 void reset_position() override;
144
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 private:
152 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
153 bool read_all) override;
155
156 public:
157 ~table_metadata_locks() override = default;
158
159 private:
161
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_md_locks.h:86
~PFS_index_metadata_locks_by_instance() override=default
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:86
PFS_key_object_instance m_key
Definition: table_md_locks.h:96
PFS_index_metadata_locks_by_instance()
Definition: table_md_locks.h:88
Definition: table_md_locks.h:99
PFS_key_object_name m_key_3
Definition: table_md_locks.h:115
PFS_key_object_schema m_key_2
Definition: table_md_locks.h:114
PFS_index_metadata_locks_by_object()
Definition: table_md_locks.h:101
PFS_key_column_name m_key_4
Definition: table_md_locks.h:116
~PFS_index_metadata_locks_by_object() override=default
PFS_key_object_type m_key_1
Definition: table_md_locks.h:113
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:96
Definition: table_md_locks.h:119
~PFS_index_metadata_locks_by_owner() override=default
bool match(const PFS_metadata_lock *pfs) override
Definition: table_md_locks.cc:130
PFS_index_metadata_locks_by_owner()
Definition: table_md_locks.h:121
PFS_key_thread_id m_key_1
Definition: table_md_locks.h:131
PFS_key_event_id m_key_2
Definition: table_md_locks.h:132
Definition: table_md_locks.h:69
~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:71
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:77
PFS_index_metadata_locks(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: table_md_locks.h:74
Definition: table_helper.h:1626
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.METADATA_LOCKS.
Definition: table_md_locks.h:136
static Plugin_table m_table_def
Table definition.
Definition: table_md_locks.h:165
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_md_locks.cc:146
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_md_locks.cc:162
int index_init(uint idx, bool sorted) override
Definition: table_md_locks.cc:189
PFS_index_metadata_locks * m_opened_index
Definition: table_md_locks.h:175
static PFS_engine_table_share m_share
Table share.
Definition: table_md_locks.h:139
static ha_rows get_row_count()
Definition: table_md_locks.cc:150
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:261
int index_next() override
Find key in index, read record.
Definition: table_md_locks.cc:212
PFS_simple_index m_pos
Current position.
Definition: table_md_locks.h:170
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_md_locks.cc:176
row_metadata_lock m_row
Current row.
Definition: table_md_locks.h:168
~table_metadata_locks() override=default
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_md_locks.cc:157
int make_row(PFS_metadata_lock *pfs)
Definition: table_md_locks.cc:233
PFS_simple_index m_next_pos
Next position.
Definition: table_md_locks.h:172
table_metadata_locks()
Definition: table_md_locks.cc:154
static THR_LOCK m_table_lock
Table share lock.
Definition: table_md_locks.h:163
int opaque_mdl_duration
Definition: psi_mdl_bits.h:41
int opaque_mdl_status
Definition: psi_mdl_bits.h:44
int opaque_mdl_type
Definition: psi_mdl_bits.h:35
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1139
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: buf0block_hint.cc:29
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:75
Performance schema tables (declarations).
Performance schema instrumentation interface.
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME, COLUMN_NAME.
Definition: table_helper.h:620
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Instrumented metadata lock implementation.
Definition: pfs_instr.h:317
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:557
Definition: table.h:1394
Definition: thr_lock.h:138
A row of table PERFORMANCE_SCHEMA.MUTEX_INSTANCES.
Definition: table_md_locks.h:51
uint m_source_length
Length in bytes of m_source.
Definition: table_md_locks.h:60
ulong m_owner_thread_id
Column OWNER_THREAD_ID.
Definition: table_md_locks.h:62
opaque_mdl_status m_mdl_status
Definition: table_md_locks.h:56
ulong m_owner_event_id
Column OWNER_EVENT_ID.
Definition: table_md_locks.h:64
opaque_mdl_duration m_mdl_duration
Definition: table_md_locks.h:55
PFS_column_row m_object
Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COLUMN_NAME.
Definition: table_md_locks.h:66
char m_source[COL_SOURCE_SIZE]
Column SOURCE.
Definition: table_md_locks.h:58
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: table_md_locks.h:53
opaque_mdl_type m_mdl_type
Definition: table_md_locks.h:54
Helpers to implement a performance schema table.