MySQL 8.4.0
Source Code Documentation
pfs_engine_table.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 PFS_ENGINE_TABLE_H
25#define PFS_ENGINE_TABLE_H
26
27#include <assert.h>
29#include <stddef.h>
30#include <sys/types.h>
31#include <atomic>
32#include <vector>
33
34#include "my_base.h"
35#include "my_compiler.h"
36
37#include "my_inttypes.h"
40#include "sql/auth/auth_common.h" /* struct ACL_* */
41#include "sql/key.h"
43
45class Plugin_table;
46struct TABLE;
47struct THR_LOCK;
48template <class T>
49class List;
50
51/**
52 @file storage/perfschema/pfs_engine_table.h
53 Performance schema tables (declarations).
54*/
55
56class Field;
58struct time_normalizer;
59
60/**
61 @addtogroup performance_schema_engine
62 @{
63*/
64
65/**
66 An abstract PERFORMANCE_SCHEMA table.
67 Every table implemented in the performance schema schema and storage engine
68 derives from this class.
69*/
71 public:
73
74 int read_row(TABLE *table, unsigned char *buf, Field **fields);
75
76 int update_row(TABLE *table, const unsigned char *old_buf,
77 unsigned char *new_buf, Field **fields);
78
79 /**
80 Delete a row from this table.
81 @param table Table handle
82 @param buf the row buffer to delete
83 @param fields Table fields
84 @return 0 on success
85 */
86 int delete_row(TABLE *table, const unsigned char *buf, Field **fields);
87
88 /** Initialize table scan. */
89 virtual int rnd_init(bool scan [[maybe_unused]]) { return 0; }
90
91 /** Fetch the next row in this cursor. */
92 virtual int rnd_next() = 0;
93
94 virtual int index_init(uint idx [[maybe_unused]],
95 bool sorted [[maybe_unused]]) {
96 assert(false);
97 return HA_ERR_UNSUPPORTED;
98 }
99
100 virtual int index_read(KEY *key_infos, uint index, const uchar *key,
101 uint key_len, enum ha_rkey_function find_flag);
102
103 virtual int index_read_last(KEY *key_infos [[maybe_unused]],
104 const uchar *key [[maybe_unused]],
105 uint key_len [[maybe_unused]]) {
106 return HA_ERR_UNSUPPORTED;
107 }
108
109 /** Find key in index, read record. */
110 virtual int index_next() { return HA_ERR_UNSUPPORTED; }
111
112 virtual int index_next_same(const uchar *key, uint key_len);
113 virtual int index_prev() { return HA_ERR_UNSUPPORTED; }
114
115 virtual int index_first() { return HA_ERR_UNSUPPORTED; }
116
117 virtual int index_last() { return HA_ERR_UNSUPPORTED; }
118
119 /**
120 Fetch a row by position.
121 @param pos position to fetch
122 */
123 virtual int rnd_pos(const void *pos) = 0;
124
125 void get_position(void *ref);
126 void set_position(const void *ref);
127 /** Reset the cursor position to the beginning of the table. */
128 virtual void reset_position() = 0;
129
130 /** Destructor. */
131 virtual ~PFS_engine_table() = default;
132
133 protected:
134 /**
135 Read the current row values.
136 @param table Table handle
137 @param buf row buffer
138 @param fields Table fields
139 @param read_all true if all columns are read.
140 */
141 virtual int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
142 bool read_all) = 0;
143
144 /**
145 Update the current row values.
146 @param table Table handle
147 @param old_buf old row buffer
148 @param new_buf new row buffer
149 @param fields Table fields
150 */
151 virtual int update_row_values(TABLE *table, const unsigned char *old_buf,
152 unsigned char *new_buf, Field **fields);
153
154 /**
155 Delete a row.
156 @param table Table handle
157 @param buf Row buffer
158 @param fields Table fields
159 */
160 virtual int delete_row_values(TABLE *table, const unsigned char *buf,
161 Field **fields);
162 /**
163 Constructor.
164 @param share table share
165 @param pos address of the m_pos position member
166 */
168 : m_share_ptr(share),
169 m_pos_ptr(pos),
171 m_index(nullptr) {}
172
173 /** Table share. */
175 /** Opaque pointer to the @c m_pos position of this cursor. */
177 /** Current normalizer */
179 /** Current index. */
181};
182
183/** Callback to open a table. */
184typedef PFS_engine_table *(*pfs_open_table_t)(PFS_engine_table_share *);
185/** Callback to write a row. */
187 unsigned char *buf, Field **fields);
188/** Callback to delete all rows. */
189typedef int (*pfs_delete_all_rows_t)();
190/** Callback to get a row count. */
192
193/**
194 PFS_key_reader: Convert key into internal format.
195*/
197 PFS_key_reader(const KEY *key_info, const uchar *key, uint key_len)
198 : m_key_info(key_info),
199 m_key_part_info(key_info->key_part),
200 m_key(key),
201 m_key_len(key_len),
202 m_remaining_key_part_info(key_info->key_part),
204 m_remaining_key_len(key_len),
205 m_parts_found(0) {}
206
207 enum ha_rkey_function read_int8(enum ha_rkey_function find_flag, bool &isnull,
208 char *value);
209
210 enum ha_rkey_function read_uint8(enum ha_rkey_function find_flag,
211 bool &isnull, uchar *value);
212
213 enum ha_rkey_function read_int16(enum ha_rkey_function find_flag,
214 bool &isnull, short *value);
215
217 bool &isnull, ushort *value);
218
219 enum ha_rkey_function read_int24(enum ha_rkey_function find_flag,
220 bool &isnull, long *value);
221
223 bool &isnull, ulong *value);
224
225 enum ha_rkey_function read_long(enum ha_rkey_function find_flag, bool &isnull,
226 long *value);
227
228 enum ha_rkey_function read_ulong(enum ha_rkey_function find_flag,
229 bool &isnull, ulong *value);
230
232 bool &isnull, longlong *value);
233
235 bool &isnull, ulonglong *value);
236
238 bool &isnull, ulonglong *value,
239 uint dec);
240
242 bool &isnull, char *buffer,
243 uint *buffer_length,
244 uint buffer_capacity);
245
247 bool &isnull, char *buffer,
248 uint *buffer_length,
249 uint buffer_capacity);
250
253 }
254
255 private:
258 const uchar *m_key;
263
264 public:
266};
267
269 public:
270 explicit PFS_engine_key(const char *name) : m_name(name), m_is_null(true) {}
271
272 virtual ~PFS_engine_key() = default;
273
274 virtual void read(PFS_key_reader &reader,
275 enum ha_rkey_function find_flag) = 0;
276
277 const char *m_name;
278
279 protected:
282};
283
285 public:
287
288 virtual ~PFS_engine_index_abstract() = default;
289
290 void set_key_info(KEY *key_info) { m_key_info = key_info; }
291
292 virtual void read_key(const uchar *key, uint key_len,
293 enum ha_rkey_function find_flag) = 0;
294
295 public:
296 uint m_fields{0};
297 KEY *m_key_info{nullptr};
298};
299
301 public:
303 : m_key_ptr_1(key_1),
308
310 : m_key_ptr_1(key_1),
311 m_key_ptr_2(key_2),
315
317 PFS_engine_key *key_3)
318 : m_key_ptr_1(key_1),
319 m_key_ptr_2(key_2),
320 m_key_ptr_3(key_3),
323
325 PFS_engine_key *key_3, PFS_engine_key *key_4)
326 : m_key_ptr_1(key_1),
327 m_key_ptr_2(key_2),
328 m_key_ptr_3(key_3),
329 m_key_ptr_4(key_4),
331
333 PFS_engine_key *key_3, PFS_engine_key *key_4,
334 PFS_engine_key *key_5)
335 : m_key_ptr_1(key_1),
336 m_key_ptr_2(key_2),
337 m_key_ptr_3(key_3),
338 m_key_ptr_4(key_4),
339 m_key_ptr_5(key_5) {}
340
341 ~PFS_engine_index() override = default;
342
343 void read_key(const uchar *key, uint key_len,
344 enum ha_rkey_function find_flag) override;
345
351};
352
353/**
354
355 A PERFORMANCE_SCHEMA table share.
356 This data is shared by all the table handles opened on the same table.
357*/
359 static void get_all_tables(List<const Plugin_table> *tables);
360 static void init_all_locks();
361 static void delete_all_locks();
362
363 /** Get the row count. */
364 ha_rows get_row_count() const;
365 /** Write a row. */
366 int write_row(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf,
367 Field **fields) const;
368 /** Table Access Control List. */
370 /** Open table function. */
372 /** Write row function. */
374 /** Delete all rows function. */
376 /** Get rows count function. */
378 /** Length of the @c m_pos position structure. */
380 /** The lock, stored on behalf of the SQL layer. */
382 /** Table definition. */
384 /** Table is available even if the Performance Schema is disabled. */
386
387 /* Interface to be implemented by plugin who adds its own table in PFS. */
389 /* Number of table objects using this share currently. */
390 std::atomic<int> m_ref_count;
391 /* is marked to be deleted? */
393};
394
395/**
396 * A class to keep list of table shares for non-native performance schema
397 * tables i.e. table created by plugins/components in performance schema.
398 */
400 public:
402
403 void init_mutex();
404
405 void destroy_mutex();
406
408
410
413 shares_vector.push_back(share);
414 }
415
416 PFS_engine_table_share *find_share(const char *table_name, bool is_dead_too);
417
419
420 private:
421 std::vector<PFS_engine_table_share *> shares_vector;
423};
424
425/* List of table shares added by plugin/component */
427
428/**
429 Privileges for read only tables.
430 The only operation allowed is SELECT.
431*/
433 public:
434 PFS_readonly_acl() = default;
435
436 ~PFS_readonly_acl() override = default;
437
438 ACL_internal_access_result check(ulong want_access, ulong *granted_access,
439 bool any_combination_will_do) const override;
440};
441
442/** Singleton instance of PFS_readonly_acl. */
444
445/**
446 Privileges for truncatable tables.
447 Operations allowed are SELECT and TRUNCATE.
448*/
450 public:
452
453 ~PFS_truncatable_acl() override = default;
454
455 ACL_internal_access_result check(ulong want_access, ulong *granted_access,
456 bool any_combination_will_do) const override;
457};
458
459/** Singleton instance of PFS_truncatable_acl. */
461
462/**
463 Privileges for updatable tables.
464 Operations allowed are SELECT and UPDATE.
465*/
467 public:
468 PFS_updatable_acl() = default;
469
470 ~PFS_updatable_acl() override = default;
471
472 ACL_internal_access_result check(ulong want_access, ulong *granted_access,
473 bool any_combination_will_do) const override;
474};
475
476/** Singleton instance of PFS_updatable_acl. */
478
479/**
480 Privileges for editable tables.
481 Operations allowed are SELECT, INSERT, UPDATE, DELETE and TRUNCATE.
482*/
484 public:
485 PFS_editable_acl() = default;
486
487 ~PFS_editable_acl() override = default;
488
489 ACL_internal_access_result check(ulong want_access, ulong *granted_access,
490 bool any_combination_will_do) const override;
491};
492
493/** Singleton instance of PFS_editable_acl. */
495
496/**
497 Privileges for unknown tables.
498*/
500 public:
501 PFS_unknown_acl() = default;
502
503 ~PFS_unknown_acl() override = default;
504
505 ACL_internal_access_result check(ulong want_access, ulong *granted_access,
506 bool any_combination_will_do) const override;
507};
508
509/** Singleton instance of PFS_unknown_acl. */
511
512/**
513 Privileges for world readable tables.
514*/
516 public:
518
519 ~PFS_readonly_world_acl() override = default;
520 ACL_internal_access_result check(ulong want_access, ulong *save_priv,
521 bool any_combination_will_do) const override;
522};
523
524/** Singleton instance of PFS_readonly_world_acl */
526
527/**
528Privileges for world readable truncatable tables.
529*/
531 public:
533
534 ~PFS_truncatable_world_acl() override = default;
535 ACL_internal_access_result check(ulong want_access, ulong *save_priv,
536 bool any_combination_will_do) const override;
537};
538
539/** Singleton instance of PFS_readonly_world_acl */
541
542/**
543 Privileges for readable processlist tables.
544*/
546 public:
548
549 ~PFS_readonly_processlist_acl() override = default;
550 ACL_internal_access_result check(ulong want_access, ulong *save_priv,
551 bool any_combination_will_do) const override;
552};
553
554/** Singleton instance of PFS_readonly_processlist_acl */
556
557/** Position of a cursor, for simple iterations. */
559 /** Current row index. */
561
562 /**
563 Constructor.
564 @param index the index initial value.
565 */
566 PFS_simple_index(uint index) : m_index(index) {}
567
568 /**
569 Set this index at a given position.
570 @param index an index
571 */
572 void set_at(uint index) { m_index = index; }
573
574 /**
575 Set this index at a given position.
576 @param other a position
577 */
578 void set_at(const PFS_simple_index *other) { m_index = other->m_index; }
579
580 /**
581 Set this index after a given position.
582 @param other a position
583 */
584 void set_after(const PFS_simple_index *other) {
585 m_index = other->m_index + 1;
586 }
587
588 /** Set this index to the next record. */
589 void next() { m_index++; }
590};
591
592/** Position of a double cursor, for iterations using 2 nested loops. */
594 /** Outer index. */
596 /** Current index within index_1. */
598
599 /**
600 Constructor.
601 @param index_1 the first index initial value.
602 @param index_2 the second index initial value.
603 */
604 PFS_double_index(uint index_1, uint index_2)
605 : m_index_1(index_1), m_index_2(index_2) {}
606
607 /**
608 Set this index at a given position.
609 */
610 void set_at(uint index_1, uint index_2) {
611 m_index_1 = index_1;
612 m_index_2 = index_2;
613 }
614
615 /**
616 Set this index at a given position.
617 @param other a position
618 */
619 void set_at(const PFS_double_index *other) {
620 m_index_1 = other->m_index_1;
621 m_index_2 = other->m_index_2;
622 }
623
624 /**
625 Set this index after a given position.
626 @param other a position
627 */
628 void set_after(const PFS_double_index *other) {
629 m_index_1 = other->m_index_1;
630 m_index_2 = other->m_index_2 + 1;
631 }
632};
633
634/** Position of a triple cursor, for iterations using 3 nested loops. */
636 /** Outer index. */
638 /** Current index within index_1. */
640 /** Current index within index_2. */
642
643 /**
644 Constructor.
645 @param index_1 the first index initial value.
646 @param index_2 the second index initial value.
647 @param index_3 the third index initial value.
648 */
649 PFS_triple_index(uint index_1, uint index_2, uint index_3)
650 : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3) {}
651
652 /**
653 Set this index at a given position.
654 */
655 void set_at(uint index_1, uint index_2, uint index_3) {
656 m_index_1 = index_1;
657 m_index_2 = index_2;
658 m_index_3 = index_3;
659 }
660
661 /**
662 Set this index at a given position.
663 @param other a position
664 */
665 void set_at(const PFS_triple_index *other) {
666 m_index_1 = other->m_index_1;
667 m_index_2 = other->m_index_2;
668 m_index_3 = other->m_index_3;
669 }
670
671 /**
672 Set this index after a given position.
673 @param other a position
674 */
675 void set_after(const PFS_triple_index *other) {
676 m_index_1 = other->m_index_1;
677 m_index_2 = other->m_index_2;
678 m_index_3 = other->m_index_3 + 1;
679 }
680};
681
682/** @} */
683
684#endif
ACL_internal_access_result
Definition: auth_common.h:84
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Per internal table ACL access rules.
Definition: auth_common.h:106
Definition: field.h:575
Definition: key.h:57
uint8 type
Definition: key.h:73
Definition: key.h:113
Definition: sql_list.h:467
A class to keep list of table shares for non-native performance schema tables i.e.
Definition: pfs_engine_table.h:399
void lock_share_list()
Definition: pfs_engine_table.h:407
mysql_mutex_t LOCK_pfs_share_list
Definition: pfs_engine_table.h:422
void add_share(PFS_engine_table_share *share)
Definition: pfs_engine_table.h:411
PFS_dynamic_table_shares()=default
std::vector< PFS_engine_table_share * > shares_vector
Definition: pfs_engine_table.h:421
void unlock_share_list()
Definition: pfs_engine_table.h:409
Privileges for editable tables.
Definition: pfs_engine_table.h:483
PFS_editable_acl()=default
~PFS_editable_acl() override=default
Definition: pfs_engine_table.h:284
uint m_fields
Definition: pfs_engine_table.h:296
KEY * m_key_info
Definition: pfs_engine_table.h:297
void set_key_info(KEY *key_info)
Definition: pfs_engine_table.h:290
PFS_engine_index_abstract()=default
virtual ~PFS_engine_index_abstract()=default
virtual void read_key(const uchar *key, uint key_len, enum ha_rkey_function find_flag)=0
Definition: pfs_engine_table.h:300
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3, PFS_engine_key *key_4)
Definition: pfs_engine_table.h:324
PFS_engine_key * m_key_ptr_2
Definition: pfs_engine_table.h:347
PFS_engine_key * m_key_ptr_4
Definition: pfs_engine_table.h:349
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: pfs_engine_table.h:309
~PFS_engine_index() override=default
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3, PFS_engine_key *key_4, PFS_engine_key *key_5)
Definition: pfs_engine_table.h:332
PFS_engine_key * m_key_ptr_5
Definition: pfs_engine_table.h:350
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3)
Definition: pfs_engine_table.h:316
PFS_engine_key * m_key_ptr_3
Definition: pfs_engine_table.h:348
PFS_engine_key * m_key_ptr_1
Definition: pfs_engine_table.h:346
PFS_engine_index(PFS_engine_key *key_1)
Definition: pfs_engine_table.h:302
Definition: pfs_engine_table.h:268
virtual ~PFS_engine_key()=default
virtual void read(PFS_key_reader &reader, enum ha_rkey_function find_flag)=0
const char * m_name
Definition: pfs_engine_table.h:277
PFS_engine_key(const char *name)
Definition: pfs_engine_table.h:270
bool m_is_null
Definition: pfs_engine_table.h:281
enum ha_rkey_function m_find_flag
Definition: pfs_engine_table.h:280
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
virtual int index_prev()
Definition: pfs_engine_table.h:113
virtual int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all)=0
Read the current row values.
PFS_engine_index_abstract * m_index
Current index.
Definition: pfs_engine_table.h:180
virtual int rnd_init(bool scan)
Initialize table scan.
Definition: pfs_engine_table.h:89
virtual int rnd_pos(const void *pos)=0
Fetch a row by position.
virtual int rnd_next()=0
Fetch the next row in this cursor.
virtual void reset_position()=0
Reset the cursor position to the beginning of the table.
virtual int index_last()
Definition: pfs_engine_table.h:117
time_normalizer * m_normalizer
Current normalizer.
Definition: pfs_engine_table.h:178
virtual int index_init(uint idx, bool sorted)
Definition: pfs_engine_table.h:94
void * m_pos_ptr
Opaque pointer to the m_pos position of this cursor.
Definition: pfs_engine_table.h:176
virtual int index_next()
Find key in index, read record.
Definition: pfs_engine_table.h:110
virtual ~PFS_engine_table()=default
Destructor.
virtual int index_first()
Definition: pfs_engine_table.h:115
virtual int index_read_last(KEY *key_infos, const uchar *key, uint key_len)
Definition: pfs_engine_table.h:103
const PFS_engine_table_share * m_share_ptr
Table share.
Definition: pfs_engine_table.h:174
PFS_engine_table(const PFS_engine_table_share *share, void *pos)
Constructor.
Definition: pfs_engine_table.h:167
Privileges for read only tables.
Definition: pfs_engine_table.h:432
~PFS_readonly_acl() override=default
PFS_readonly_acl()=default
Privileges for readable processlist tables.
Definition: pfs_engine_table.h:545
~PFS_readonly_processlist_acl() override=default
Privileges for world readable tables.
Definition: pfs_engine_table.h:515
~PFS_readonly_world_acl() override=default
PFS_readonly_world_acl()=default
Privileges for truncatable tables.
Definition: pfs_engine_table.h:449
PFS_truncatable_acl()=default
~PFS_truncatable_acl() override=default
Privileges for world readable truncatable tables.
Definition: pfs_engine_table.h:530
PFS_truncatable_world_acl()=default
~PFS_truncatable_world_acl() override=default
Privileges for unknown tables.
Definition: pfs_engine_table.h:499
PFS_unknown_acl()=default
~PFS_unknown_acl() override=default
Privileges for updatable tables.
Definition: pfs_engine_table.h:466
~PFS_updatable_acl() override=default
PFS_updatable_acl()=default
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
static const std::string dec("DECRYPTION")
enum ha_rkey_function read_long(enum ha_rkey_function find_flag, bool &isnull, long *value)
Definition: pfs_engine_table.cc:1320
ACL_internal_access_result check(ulong want_access, ulong *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1141
int delete_row(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row from this table.
Definition: pfs_engine_table.cc:786
static void delete_all_locks()
Delete all the table share locks.
Definition: pfs_engine_table.cc:653
ha_rows(* pfs_get_row_count_t)()
Callback to get a row count.
Definition: pfs_engine_table.h:191
enum ha_rkey_function read_uint8(enum ha_rkey_function find_flag, bool &isnull, uchar *value)
Definition: pfs_engine_table.cc:1295
ACL_internal_access_result check(ulong want_access, ulong *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1172
virtual int index_read(KEY *key_infos, uint index, const uchar *key, uint key_len, enum ha_rkey_function find_flag)
Positions an index cursor to the index specified in the handle.
Definition: pfs_engine_table.cc:829
enum ha_rkey_function read_ulong(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1325
void get_position(void *ref)
Get the position of the current row.
Definition: pfs_engine_table.cc:807
int read_row(TABLE *table, unsigned char *buf, Field **fields)
Read a table row.
Definition: pfs_engine_table.cc:738
ACL_internal_access_result check(ulong want_access, ulong *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1210
int(* pfs_write_row_t)(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf, Field **fields)
Callback to write a row.
Definition: pfs_engine_table.h:186
ha_rows get_row_count() const
Get the row count.
Definition: pfs_engine_table.cc:661
PFS_readonly_world_acl pfs_readonly_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1063
static void init_all_locks()
Initialize all the table share locks.
Definition: pfs_engine_table.cc:644
enum ha_rkey_function read_text_utf8(enum ha_rkey_function find_flag, bool &isnull, char *buffer, uint *buffer_length, uint buffer_capacity)
Definition: pfs_engine_table.cc:1422
enum ha_rkey_function read_int8(enum ha_rkey_function find_flag, bool &isnull, char *value)
Definition: pfs_engine_table.cc:1290
ACL_internal_access_result check(ulong want_access, ulong *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1129
void set_position(const void *ref)
Set the table cursor at a given position.
Definition: pfs_engine_table.cc:815
static PFS_engine_table_share * find_engine_table_share(const char *name)
Find a table share by name.
Definition: pfs_engine_table.cc:710
PFS_truncatable_acl pfs_truncatable_acl
Singleton instance of PFS_truncatable_acl.
Definition: pfs_engine_table.cc:1088
virtual int update_row_values(TABLE *table, const unsigned char *old_buf, unsigned char *new_buf, Field **fields)
Update the current row values.
Definition: pfs_engine_table.cc:819
enum ha_rkey_function read_varchar_utf8(enum ha_rkey_function find_flag, bool &isnull, char *buffer, uint *buffer_length, uint buffer_capacity)
Definition: pfs_engine_table.cc:1370
enum ha_rkey_function read_longlong(enum ha_rkey_function find_flag, bool &isnull, longlong *value)
Definition: pfs_engine_table.cc:1330
int write_row(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf, Field **fields) const
Write a row.
Definition: pfs_engine_table.cc:665
enum ha_rkey_function read_uint24(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1315
void init_mutex()
Definition: pfs_engine_table.cc:620
ACL_internal_access_result check(ulong want_access, ulong *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1077
enum ha_rkey_function read_timestamp(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value, uint dec)
Definition: pfs_engine_table.cc:1340
enum ha_rkey_function read_ulonglong(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value)
Definition: pfs_engine_table.cc:1335
PFS_truncatable_world_acl pfs_truncatable_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1127
PFS_updatable_acl pfs_updatable_acl
Singleton instance of PFS_updatable_acl.
Definition: pfs_engine_table.cc:1139
ACL_internal_access_result check(ulong want_access, ulong *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1065
PFS_readonly_acl pfs_readonly_acl
Singleton instance of PFS_readonly_acl.
Definition: pfs_engine_table.cc:1031
void remove_share(PFS_engine_table_share *share)
Remove a share from the list.
Definition: pfs_engine_table.cc:890
PFS_readonly_processlist_acl pfs_readonly_processlist_acl
Singleton instance of PFS_readonly_processlist_acl.
Definition: pfs_engine_table.cc:1075
int(* pfs_delete_all_rows_t)()
Callback to delete all rows.
Definition: pfs_engine_table.h:189
int update_row(TABLE *table, const unsigned char *old_buf, unsigned char *new_buf, Field **fields)
Update a table row.
Definition: pfs_engine_table.cc:774
PFS_editable_acl pfs_editable_acl
Singleton instance of PFS_editable_acl.
Definition: pfs_engine_table.cc:1170
void read_key(const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: pfs_engine_table.cc:1476
void destroy_mutex()
Definition: pfs_engine_table.cc:628
static void get_all_tables(List< const Plugin_table > *tables)
Get all the core performance schema tables.
Definition: pfs_engine_table.cc:635
virtual int delete_row_values(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row.
Definition: pfs_engine_table.cc:798
enum ha_rkey_function read_uint16(enum ha_rkey_function find_flag, bool &isnull, ushort *value)
Definition: pfs_engine_table.cc:1305
ACL_internal_access_result check(ulong want_access, ulong *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1033
PFS_unknown_acl pfs_unknown_acl
Singleton instance of PFS_unknown_acl.
Definition: pfs_engine_table.cc:1208
enum ha_rkey_function read_int16(enum ha_rkey_function find_flag, bool &isnull, short *value)
Definition: pfs_engine_table.cc:1300
PFS_engine_table_share * find_share(const char *table_name, bool is_dead_too)
Find a share in the list.
Definition: pfs_engine_table.cc:871
enum ha_rkey_function read_int24(enum ha_rkey_function find_flag, bool &isnull, long *value)
Definition: pfs_engine_table.cc:1310
ACL_internal_access_result check(ulong want_access, ulong *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1090
PFS_engine_table *(* pfs_open_table_t)(PFS_engine_table_share *)
Callback to open a table.
Definition: pfs_engine_table.h:184
virtual int index_next_same(const uchar *key, uint key_len)
Reads the next row matching the given key value.
Definition: pfs_engine_table.cc:860
PFS_dynamic_table_shares pfs_external_table_shares
Definition: pfs_engine_table.cc:632
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:112
mysql_service_pfs_plugin_table_v1_t * pfs_table
Definition: log0pfs.cc:47
This file includes constants used by all storage engines.
ha_base_keytype
Definition: my_base.h:440
#define HA_ERR_UNSUPPORTED
unsupported extension used
Definition: my_base.h:855
ha_rkey_function
Definition: my_base.h:78
my_off_t ha_rows
Definition: my_base.h:1141
Header for compiler-dependent features.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
ABI for instrumented mutexes.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
const char * table_name
Definition: rules_table_service.cc:56
Instrumentation helpers for mutexes.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
case opt name
Definition: sslopt-case.h:29
Performance schema instrumentation (declarations).
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:593
void set_after(const PFS_double_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:628
void set_at(uint index_1, uint index_2)
Set this index at a given position.
Definition: pfs_engine_table.h:610
PFS_double_index(uint index_1, uint index_2)
Constructor.
Definition: pfs_engine_table.h:604
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:595
void set_at(const PFS_double_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:619
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:597
A structure to keep callback functions to be implemented by plugin/component.
Definition: pfs_plugin_table_service.h:413
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
PFS_engine_table_proxy m_st_table
Definition: pfs_engine_table.h:388
std::atomic< int > m_ref_count
Definition: pfs_engine_table.h:390
bool m_in_purgatory
Definition: pfs_engine_table.h:392
const Plugin_table * m_table_def
Table definition.
Definition: pfs_engine_table.h:383
const ACL_internal_table_access * m_acl
Table Access Control List.
Definition: pfs_engine_table.h:369
pfs_write_row_t m_write_row
Write row function.
Definition: pfs_engine_table.h:373
uint m_ref_length
Length of the m_pos position structure.
Definition: pfs_engine_table.h:379
pfs_delete_all_rows_t m_delete_all_rows
Delete all rows function.
Definition: pfs_engine_table.h:375
pfs_get_row_count_t m_get_row_count
Get rows count function.
Definition: pfs_engine_table.h:377
THR_LOCK * m_thr_lock_ptr
The lock, stored on behalf of the SQL layer.
Definition: pfs_engine_table.h:381
pfs_open_table_t m_open_table
Open table function.
Definition: pfs_engine_table.h:371
bool m_perpetual
Table is available even if the Performance Schema is disabled.
Definition: pfs_engine_table.h:385
PFS_key_reader: Convert key into internal format.
Definition: pfs_engine_table.h:196
uint m_parts_found
Definition: pfs_engine_table.h:265
PFS_key_reader(const KEY *key_info, const uchar *key, uint key_len)
Definition: pfs_engine_table.h:197
const KEY_PART_INFO * m_remaining_key_part_info
Definition: pfs_engine_table.h:260
ha_base_keytype get_key_type()
Definition: pfs_engine_table.h:251
const KEY * m_key_info
Definition: pfs_engine_table.h:256
uint m_remaining_key_len
Definition: pfs_engine_table.h:262
const uchar * m_remaining_key
Definition: pfs_engine_table.h:261
const uchar * m_key
Definition: pfs_engine_table.h:258
uint m_key_len
Definition: pfs_engine_table.h:259
const KEY_PART_INFO * m_key_part_info
Definition: pfs_engine_table.h:257
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:558
PFS_simple_index(uint index)
Constructor.
Definition: pfs_engine_table.h:566
void set_at(const PFS_simple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:578
void set_at(uint index)
Set this index at a given position.
Definition: pfs_engine_table.h:572
void set_after(const PFS_simple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:584
void next()
Set this index to the next record.
Definition: pfs_engine_table.h:589
uint m_index
Current row index.
Definition: pfs_engine_table.h:560
Position of a triple cursor, for iterations using 3 nested loops.
Definition: pfs_engine_table.h:635
void set_at(const PFS_triple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:665
uint m_index_3
Current index within index_2.
Definition: pfs_engine_table.h:641
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:639
PFS_triple_index(uint index_1, uint index_2, uint index_3)
Constructor.
Definition: pfs_engine_table.h:649
void set_after(const PFS_triple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:675
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:637
void set_at(uint index_1, uint index_2, uint index_3)
Set this index at a given position.
Definition: pfs_engine_table.h:655
Definition: table.h:1405
Definition: thr_lock.h:139
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
A time normalizer.
Definition: pfs_timer.h:119