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