MySQL 8.1.0
Source Code Documentation
table_file_instances.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 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_FILE_INSTANCES_H
24#define TABLE_FILE_INSTANCES_H
25
26/**
27 @file storage/perfschema/table_file_instances.h
28 Table FILE_INSTANCES (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
36
37class Field;
38class Plugin_table;
39struct PFS_file;
40struct TABLE;
41struct THR_LOCK;
42
43/**
44 @addtogroup performance_schema_tables
45 @{
46*/
47
48/** A row of PERFORMANCE_SCHEMA.FILE_INSTANCES. */
50 /** Column FILE_NAME. */
52 /** Column EVENT_NAME. */
53 const char *m_event_name;
54 /** Length in bytes of @c m_event_name. */
56 /** Column OPEN_COUNT. */
58};
59
61 public:
63 : PFS_engine_index(key_1) {}
64
65 ~PFS_index_file_instances() override = default;
66
67 virtual bool match(const PFS_file *pfs) = 0;
68};
69
71 public:
73 : PFS_index_file_instances(&m_key), m_key("FILE_NAME") {}
74
76
77 bool match(const PFS_file *pfs) override;
78
79 private:
81};
82
84 public:
86 : PFS_index_file_instances(&m_key), m_key("EVENT_NAME") {}
87
89
90 bool match(const PFS_file *pfs) override;
91
92 private:
94};
95
96/** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */
98 public:
99 /** Table share */
102 static ha_rows get_row_count();
103
104 void reset_position() override;
105
106 int rnd_next() override;
107 int rnd_pos(const void *pos) override;
108
109 int index_init(uint idx, bool sorted) override;
110 int index_next() override;
111
112 private:
113 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
114 bool read_all) override;
116
117 public:
118 ~table_file_instances() override = default;
119
120 private:
121 int make_row(PFS_file *pfs);
122
123 /** Table share lock. */
125 /** Table definition. */
127
128 /** Current row. */
130 /** Current position. */
132 /** Next position. */
134
136};
137
138/** @} */
139#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_file_instances.h:83
~PFS_index_file_instances_by_event_name() override=default
bool match(const PFS_file *pfs) override
Definition: table_file_instances.cc:87
PFS_index_file_instances_by_event_name()
Definition: table_file_instances.h:85
PFS_key_event_name m_key
Definition: table_file_instances.h:93
Definition: table_file_instances.h:70
~PFS_index_file_instances_by_file_name() override=default
PFS_index_file_instances_by_file_name()
Definition: table_file_instances.h:72
bool match(const PFS_file *pfs) override
Definition: table_file_instances.cc:78
PFS_key_file_name m_key
Definition: table_file_instances.h:80
Definition: table_file_instances.h:60
PFS_index_file_instances(PFS_engine_key *key_1)
Definition: table_file_instances.h:62
virtual bool match(const PFS_file *pfs)=0
~PFS_index_file_instances() override=default
Definition: table_helper.h:1431
Definition: table_helper.h:1586
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Table PERFORMANCE_SCHEMA.FILE_INSTANCES.
Definition: table_file_instances.h:97
table_file_instances()
Definition: table_file_instances.cc:104
row_file_instances m_row
Current row.
Definition: table_file_instances.h:129
PFS_index_file_instances * m_opened_index
Definition: table_file_instances.h:135
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_file_instances.cc:112
PFS_simple_index m_pos
Current position.
Definition: table_file_instances.h:131
PFS_simple_index m_next_pos
Next position.
Definition: table_file_instances.h:133
int make_row(PFS_file *pfs)
Definition: table_file_instances.cc:180
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_file_instances.cc:107
static PFS_engine_table_share m_share
Table share.
Definition: table_file_instances.h:100
int index_init(uint idx, bool sorted) override
Definition: table_file_instances.cc:139
int index_next() override
Find key in index, read record.
Definition: table_file_instances.cc:159
static ha_rows get_row_count()
Definition: table_file_instances.cc:100
static THR_LOCK m_table_lock
Table share lock.
Definition: table_file_instances.h:124
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_file_instances.cc:126
~table_file_instances() override=default
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_file_instances.cc:96
static Plugin_table m_table_def
Table definition.
Definition: table_file_instances.h:126
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_file_instances.cc:204
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
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:287
Instrumented File and FILE implementation.
Definition: pfs_instr.h:178
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 PERFORMANCE_SCHEMA.FILE_INSTANCES.
Definition: table_file_instances.h:49
PFS_file_name m_file_name
Column FILE_NAME.
Definition: table_file_instances.h:51
uint m_open_count
Column OPEN_COUNT.
Definition: table_file_instances.h:57
uint m_event_name_length
Length in bytes of m_event_name.
Definition: table_file_instances.h:55
const char * m_event_name
Column EVENT_NAME.
Definition: table_file_instances.h:53
Helpers to implement a performance schema table.