MySQL 8.0.39
Source Code Documentation
table_socket_instances.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 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_SOCKET_INSTANCES_H
25#define TABLE_SOCKET_INSTANCES_H
26
27/**
28 @file storage/perfschema/table_socket_instances.h
29 Table SOCKET_INSTANCES (declarations).
30*/
31
32#include "my_config.h"
33
34#ifdef HAVE_NETINET_IN_H
35#include <netinet/in.h>
36#endif
37#include <sys/types.h>
38
39#include "my_base.h"
40#include "my_inttypes.h"
44
45class Field;
46class Plugin_table;
47struct PFS_socket;
48struct TABLE;
49struct THR_LOCK;
50
51/**
52 @addtogroup performance_schema_tables
53 @{
54*/
55
56/** A row of PERFORMANCE_SCHEMA.SOCKET_INSTANCES. */
58 /** Column EVENT_NAME. */
59 const char *m_event_name;
60 /** Length in bytes of @c m_event_name. */
62 /** Column OBJECT_INSTANCE_BEGIN */
63 const void *m_identity;
64 /** Column THREAD_ID */
66 /** True if thread_is is set */
68 /** Column SOCKET_ID */
70 /** Socket ip address, IPV4 or IPV6 */
71 char m_ip[INET6_ADDRSTRLEN + 1];
72 /** Length in bytes of @c m_ip. */
74 /** Column PORT */
76 /** Socket state: ACTIVE or IDLE */
78
80};
81
83 public:
85 : PFS_engine_index(key_1) {}
86
88 : PFS_engine_index(key_1, key_2) {}
89
90 ~PFS_index_socket_instances() override = default;
91
92 virtual bool match(const PFS_socket *pfs) = 0;
93};
94
97 public:
99 : PFS_index_socket_instances(&m_key), m_key("OBJECT_INSTANCE_BEGIN") {}
100
102
103 bool match(const PFS_socket *pfs) override;
104
105 private:
107};
108
110 public:
112 : PFS_index_socket_instances(&m_key), m_key("THREAD_ID") {}
113
115
116 bool match(const PFS_socket *pfs) override;
117
118 private:
120};
121
123 public:
125 : PFS_index_socket_instances(&m_key), m_key("SOCKET_ID") {}
126
128
129 bool match(const PFS_socket *pfs) override;
130
131 private:
133};
134
137 public:
140 m_key_1("IP"),
141 m_key_2("PORT") {}
142
144
145 bool match(const PFS_socket *pfs) override;
146
147 private:
150};
151
152/** Table PERFORMANCE_SCHEMA.SOCKET_INSTANCES. */
154 public:
155 /** Table share */
158 static ha_rows get_row_count();
159
160 void reset_position() override;
161
162 int rnd_next() override;
163 int rnd_pos(const void *pos) override;
164
165 int index_init(uint idx, bool sorted) override;
166 int index_next() override;
167
168 private:
169 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
170 bool read_all) override;
172
173 public:
174 ~table_socket_instances() override = default;
175
176 protected:
177 int make_row(PFS_socket *pfs);
178
179 /** Table share lock. */
181 /** Table definition. */
183
184 /** Current row. */
186 /** Current position. */
188 /** Next position. */
190
192};
193
194/** @} */
195#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_socket_instances.h:96
bool match(const PFS_socket *pfs) override
Definition: table_socket_instances.cc:85
~PFS_index_socket_instances_by_instance() override=default
PFS_index_socket_instances_by_instance()
Definition: table_socket_instances.h:98
PFS_key_object_instance m_key
Definition: table_socket_instances.h:106
Definition: table_socket_instances.h:136
PFS_key_port m_key_2
Definition: table_socket_instances.h:149
PFS_key_ip m_key_1
Definition: table_socket_instances.h:148
~PFS_index_socket_instances_by_ip_port() override=default
PFS_index_socket_instances_by_ip_port()
Definition: table_socket_instances.h:138
bool match(const PFS_socket *pfs) override
Definition: table_socket_instances.cc:112
Definition: table_socket_instances.h:122
bool match(const PFS_socket *pfs) override
Definition: table_socket_instances.cc:103
PFS_key_socket_id m_key
Definition: table_socket_instances.h:132
~PFS_index_socket_instances_by_socket() override=default
PFS_index_socket_instances_by_socket()
Definition: table_socket_instances.h:124
Definition: table_socket_instances.h:109
PFS_key_thread_id m_key
Definition: table_socket_instances.h:119
bool match(const PFS_socket *pfs) override
Definition: table_socket_instances.cc:94
~PFS_index_socket_instances_by_thread() override=default
PFS_index_socket_instances_by_thread()
Definition: table_socket_instances.h:111
Definition: table_socket_instances.h:82
virtual bool match(const PFS_socket *pfs)=0
PFS_index_socket_instances(PFS_engine_key *key_1)
Definition: table_socket_instances.h:84
~PFS_index_socket_instances() override=default
PFS_index_socket_instances(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: table_socket_instances.h:87
Definition: table_helper.h:1592
Definition: table_helper.h:1700
Definition: table_helper.h:1363
Definition: table_helper.h:1354
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.SOCKET_INSTANCES.
Definition: table_socket_instances.h:153
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_socket_instances.cc:157
static PFS_engine_table_share m_share
Table share.
Definition: table_socket_instances.h:156
int index_next() override
Find key in index, read record.
Definition: table_socket_instances.cc:196
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_socket_instances.cc:255
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_socket_instances.cc:138
static THR_LOCK m_table_lock
Table share lock.
Definition: table_socket_instances.h:180
PFS_simple_index m_next_pos
Next position.
Definition: table_socket_instances.h:189
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_socket_instances.cc:143
table_socket_instances()
Definition: table_socket_instances.cc:135
row_socket_instances m_row
Current row.
Definition: table_socket_instances.h:185
static ha_rows get_row_count()
Definition: table_socket_instances.cc:131
~table_socket_instances() override=default
PFS_simple_index m_pos
Current position.
Definition: table_socket_instances.h:187
static Plugin_table m_table_def
Table definition.
Definition: table_socket_instances.h:182
int make_row(PFS_socket *pfs)
Definition: table_socket_instances.cc:217
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_socket_instances.cc:127
PFS_index_socket_instances * m_opened_index
Definition: table_socket_instances.h:191
int index_init(uint idx, bool sorted) override
Definition: table_socket_instances.cc:170
PSI_socket_state
State of an instrumented socket.
Definition: psi_socket_bits.h:80
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
Performance schema instrumentation interface.
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Instrumented socket implementation.
Definition: pfs_instr.h:287
Definition: table.h:1399
Definition: thr_lock.h:139
A row of PERFORMANCE_SCHEMA.SOCKET_INSTANCES.
Definition: table_socket_instances.h:57
PSI_socket_state m_state
Socket state: ACTIVE or IDLE.
Definition: table_socket_instances.h:77
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: table_socket_instances.h:63
char m_ip[INET6_ADDRSTRLEN+1]
Socket ip address, IPV4 or IPV6.
Definition: table_socket_instances.h:71
row_socket_instances()
Definition: table_socket_instances.h:79
uint m_ip_length
Length in bytes of m_ip.
Definition: table_socket_instances.h:73
uint m_port
Column PORT.
Definition: table_socket_instances.h:75
uint m_event_name_length
Length in bytes of m_event_name.
Definition: table_socket_instances.h:61
ulonglong m_thread_id
Column THREAD_ID.
Definition: table_socket_instances.h:65
const char * m_event_name
Column EVENT_NAME.
Definition: table_socket_instances.h:59
uint m_fd
Column SOCKET_ID.
Definition: table_socket_instances.h:69
bool m_thread_id_set
True if thread_is is set.
Definition: table_socket_instances.h:67
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca9-dump.cc:75