MySQL 8.0.31
Source Code Documentation
table_processlist.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_PROCESSLIST_H
24#define TABLE_PROCESSLIST_H
25
26/**
27 @file storage/perfschema/table_processlist.h
28 TABLE THREADS.
29*/
30
31#include <sys/types.h>
32#include <time.h>
33#include <algorithm>
34
35#include "my_hostname.h"
36#include "my_inttypes.h"
40
41struct PFS_thread;
42
43/**
44 @addtogroup performance_schema_tables
45 @{
46*/
47
48/**
49 A row of PERFORMANCE_SCHEMA.PROCESSLIST.
50*/
52 /** Column ID. */
54 /** Column USER. */
56 /** Column HOST (and PORT). */
58 /** Length in bytes of @c m_hostname. */
60 /** Column DB. */
62 /** Column COMMAND. */
64 /** Column TIME. */
66 /** Column STATE. */
68 /** Length in bytes of @c m_processlist_state_ptr. */
70 /** Column INFO. */
72 /** Length in bytes of @c m_processlist_info_ptr. */
74 /** Column EXECUTION_ENGINE. */
76};
77
79 public:
81 : PFS_index_threads(&m_key), m_key("ID") {}
82
84
85 virtual bool match(PFS_thread *pfs) override;
86
87 private:
89};
90
92 /** User is not allowed to see any data. */
94 /** User does not have the PROCESS_ACL privilege. */
96 /** User has the PROCESS_ACL privilege. */
98};
99
104};
105
106/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */
108 public:
109 /** Table share */
111 /** Table builder */
113
114 protected:
116
117 int rnd_init(bool scan [[maybe_unused]]) override;
118
119 int index_init(uint idx, bool sorted) override;
120 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
121 bool read_all) override;
122 int set_access(void);
123
124 public:
125 ~table_processlist() override = default;
126
127 private:
128 virtual int make_row(PFS_thread *pfs) override;
129 /** Table share lock. */
131 /** Table definition. */
133 /** Current row. */
135 /** Row privileges. */
137};
138
139/** @} */
140#endif
Definition: field.h:574
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_processlist.h:78
PFS_index_processlist_by_processlist_id()
Definition: table_processlist.h:80
virtual bool match(PFS_thread *pfs) override
Definition: table_processlist.cc:133
PFS_key_processlist_id m_key
Definition: table_processlist.h:88
~PFS_index_processlist_by_processlist_id() override=default
Definition: cursor_by_thread.h:41
Definition: table_helper.h:1280
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Cursor CURSOR_BY_THREAD.
Definition: cursor_by_thread.h:54
Table PERFORMANCE_SCHEMA.PROCESSLIST.
Definition: table_processlist.h:107
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_processlist.cc:128
row_processlist m_row
Current row.
Definition: table_processlist.h:134
table_processlist()
Definition: table_processlist.cc:94
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_processlist.cc:318
static PFS_engine_table_share m_share
Table share.
Definition: table_processlist.h:110
int set_access(void)
Definition: table_processlist.cc:98
row_priv_processlist m_row_priv
Row privileges.
Definition: table_processlist.h:136
~table_processlist() override=default
int index_init(uint idx, bool sorted) override
Definition: table_processlist.cc:142
static Plugin_table m_table_def
Table definition.
Definition: table_processlist.h:132
static THR_LOCK m_table_lock
Table share lock.
Definition: table_processlist.h:130
static PFS_engine_table * create(PFS_engine_table_share *)
Table builder.
Definition: table_processlist.cc:90
virtual int make_row(PFS_thread *pfs) override
Definition: table_processlist.cc:157
Cursor CURSOR_BY_THREAD (declarations).
enum_priv_processlist
Definition: table_processlist.h:91
@ PROCESSLIST_USER_ONLY
User does not have the PROCESS_ACL privilege.
Definition: table_processlist.h:95
@ PROCESSLIST_DENIED
User is not allowed to see any data.
Definition: table_processlist.h:93
@ PROCESSLIST_ALL
User has the PROCESS_ACL privilege.
Definition: table_processlist.h:97
Common definition used by mysys, performance schema and server & client.
static constexpr int HOST_AND_PORT_LENGTH
Length of "hostname:portnumber".
Definition: my_hostname.h:54
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
#define USERNAME_LENGTH
Definition: mysql_com.h:68
Definition: buf0block_hint.cc:29
Data types for columns used in the performance schema tables (declarations)
Object names (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:115
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: pfs_name.h:222
Definition: table.h:1396
Definition: thr_lock.h:138
Definition: table_processlist.h:100
char m_priv_user[USERNAME_LENGTH]
Definition: table_processlist.h:102
size_t m_priv_user_length
Definition: table_processlist.h:103
enum enum_priv_processlist m_auth
Definition: table_processlist.h:101
A row of PERFORMANCE_SCHEMA.PROCESSLIST.
Definition: table_processlist.h:51
uint m_hostname_length
Length in bytes of m_hostname.
Definition: table_processlist.h:59
PFS_schema_name m_db_name
Column DB.
Definition: table_processlist.h:61
PFS_user_name m_user_name
Column USER.
Definition: table_processlist.h:55
uint m_processlist_state_length
Length in bytes of m_processlist_state_ptr.
Definition: table_processlist.h:69
int m_command
Column COMMAND.
Definition: table_processlist.h:63
time_t m_start_time
Column TIME.
Definition: table_processlist.h:65
const char * m_processlist_info_ptr
Column INFO.
Definition: table_processlist.h:71
char m_hostname[HOST_AND_PORT_LENGTH]
Column HOST (and PORT).
Definition: table_processlist.h:57
ulonglong m_processlist_id
Column ID.
Definition: table_processlist.h:53
const char * m_processlist_state_ptr
Column STATE.
Definition: table_processlist.h:67
bool m_secondary
Column EXECUTION_ENGINE.
Definition: table_processlist.h:75
uint m_processlist_info_length
Length in bytes of m_processlist_info_ptr.
Definition: table_processlist.h:73
Include file for Sun RPC to compile out of the box.
unsigned int uint
Definition: uca-dump.cc:29