MySQL 8.0.31
Source Code Documentation
table_status_by_thread.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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_STATUS_BY_THREAD_H
24#define TABLE_STATUS_BY_THREAD_H
25
26/**
27 @file storage/perfschema/table_status_by_thread.h
28 Table STATUS_BY_THREAD (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
34#include "my_inttypes.h"
40
41class Field;
42class Plugin_table;
43struct PFS_thread;
44struct TABLE;
45struct THR_LOCK;
46/**
47 @addtogroup performance_schema_tables
48 @{
49*/
50
51/**
52 A row of table
53 PERFORMANCE_SCHEMA.STATUS_BY_THREAD.
54*/
56 /** Column THREAD_ID. */
58 /** Column VARIABLE_NAME. */
60 /** Column VARIABLE_VALUE. */
62};
63
64/**
65 Position of a cursor on
66 PERFORMANCE_SCHEMA.STATUS_BY_THREAD.
67 Index 1 on thread (0 based)
68 Index 2 on status variable (0 based)
69*/
72
73 inline void reset(void) {
74 m_index_1 = 0;
75 m_index_2 = 0;
76 }
77
78 inline bool has_more_thread(void) {
80 }
81
82 inline void next_thread(void) {
83 m_index_1++;
84 m_index_2 = 0;
85 }
86};
87
89 public:
92 m_key_1("THREAD_ID"),
93 m_key_2("VARIABLE_NAME") {}
94
95 ~PFS_index_status_by_thread() override = default;
96
97 virtual bool match(PFS_thread *pfs);
98 virtual bool match(const Status_variable *pfs);
99
100 private:
103};
104
105/** Table PERFORMANCE_SCHEMA.STATUS_BY_THREAD. */
108
109 public:
110 /** Table share */
113 static int delete_all_rows();
114 static ha_rows get_row_count();
115
116 void reset_position(void) override;
117
118 int rnd_init(bool scan) override;
119 int rnd_next() override;
120 int rnd_pos(const void *pos) override;
121
122 int index_init(uint idx, bool sorted) override;
123 int index_next() override;
124
125 protected:
126 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
127 bool read_all) override;
129
130 public:
131 ~table_status_by_thread() override = default;
132
133 protected:
134 int make_row(PFS_thread *thread, const Status_variable *status_var);
135
136 private:
137 /** Table share lock. */
139 /** Table definition. */
141
142 /** Current THD variables. */
144 /** Current row. */
146 /** Current position. */
148 /** Next position. */
150
152};
153
154/** @} */
155#endif
Definition: field.h:574
size_t get_row_count()
Definition: pfs_buffer_container.h:464
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_status_by_thread.h:88
~PFS_index_status_by_thread() override=default
PFS_index_status_by_thread()
Definition: table_status_by_thread.h:90
PFS_key_thread_id m_key_1
Definition: table_status_by_thread.h:101
PFS_key_variable_name m_key_2
Definition: table_status_by_thread.h:102
virtual bool match(PFS_thread *pfs)
Definition: table_status_by_thread.cc:46
Definition: table_helper.h:1250
Definition: table_helper.h:1531
Status variable cache.
Definition: pfs_variable.h:679
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Status variable derived from SHOW_VAR.
Definition: pfs_variable.h:209
Table PERFORMANCE_SCHEMA.STATUS_BY_THREAD.
Definition: table_status_by_thread.h:106
static ha_rows get_row_count()
Definition: table_status_by_thread.cc:112
static int delete_all_rows()
Definition: table_status_by_thread.cc:102
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_status_by_thread.cc:130
table_status_by_thread()
Definition: table_status_by_thread.cc:119
static Plugin_table m_table_def
Table definition.
Definition: table_status_by_thread.h:140
PFS_index_status_by_thread * m_opened_index
Definition: table_status_by_thread.h:151
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_status_by_thread.cc:244
pos_t m_pos
Current position.
Definition: table_status_by_thread.h:147
row_status_by_thread m_row
Current row.
Definition: table_status_by_thread.h:145
void reset_position(void) override
Reset the cursor position to the beginning of the table.
Definition: table_status_by_thread.cc:125
pos_t m_next_pos
Next position.
Definition: table_status_by_thread.h:149
PFS_status_variable_cache m_status_cache
Current THD variables.
Definition: table_status_by_thread.h:143
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_status_by_thread.cc:138
int index_init(uint idx, bool sorted) override
Definition: table_status_by_thread.cc:173
pos_status_by_thread pos_t
Definition: table_status_by_thread.h:107
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_status_by_thread.cc:158
~table_status_by_thread() override=default
int make_row(PFS_thread *thread, const Status_variable *status_var)
Definition: table_status_by_thread.cc:216
static PFS_engine_table_share m_share
Table share.
Definition: table_status_by_thread.h:111
int index_next() override
Find key in index, read record.
Definition: table_status_by_thread.cc:186
static THR_LOCK m_table_lock
Table share lock.
Definition: table_status_by_thread.h:138
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_status_by_thread.cc:98
char * pos
Definition: do_ctype.cc:76
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
Generic buffer container.
PFS_thread_container global_thread_container
Performance schema tables (declarations).
Performance schema system and status variables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Performance schema instrumentation (declarations).
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:593
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:595
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:597
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Instrumented thread implementation.
Definition: pfs_instr.h:372
Definition: table_helper.h:1086
Definition: table_helper.h:1099
Definition: table.h:1396
Definition: thr_lock.h:138
Position of a cursor on PERFORMANCE_SCHEMA.STATUS_BY_THREAD.
Definition: table_status_by_thread.h:70
bool has_more_thread(void)
Definition: table_status_by_thread.h:78
pos_status_by_thread()
Definition: table_status_by_thread.h:71
void reset(void)
Definition: table_status_by_thread.h:73
void next_thread(void)
Definition: table_status_by_thread.h:82
A row of table PERFORMANCE_SCHEMA.STATUS_BY_THREAD.
Definition: table_status_by_thread.h:55
PFS_variable_value_row m_variable_value
Column VARIABLE_VALUE.
Definition: table_status_by_thread.h:61
ulonglong m_thread_internal_id
Column THREAD_ID.
Definition: table_status_by_thread.h:57
PFS_variable_name_row m_variable_name
Column VARIABLE_NAME.
Definition: table_status_by_thread.h:59
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca-dump.cc:29