MySQL 9.0.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
439 Access_bitmask *granted_access,
440 bool any_combination_will_do) const override;
441};
442
443/** Singleton instance of PFS_readonly_acl. */
445
446/**
447 Privileges for truncatable tables.
448 Operations allowed are SELECT and TRUNCATE.
449*/
451 public:
453
454 ~PFS_truncatable_acl() override = default;
455
457 Access_bitmask *granted_access,
458 bool any_combination_will_do) const override;
459};
460
461/** Singleton instance of PFS_truncatable_acl. */
463
464/**
465 Privileges for updatable tables.
466 Operations allowed are SELECT and UPDATE.
467*/
469 public:
470 PFS_updatable_acl() = default;
471
472 ~PFS_updatable_acl() override = default;
473
475 Access_bitmask *granted_access,
476 bool any_combination_will_do) const override;
477};
478
479/** Singleton instance of PFS_updatable_acl. */
481
482/**
483 Privileges for editable tables.
484 Operations allowed are SELECT, INSERT, UPDATE, DELETE and TRUNCATE.
485*/
487 public:
488 PFS_editable_acl() = default;
489
490 ~PFS_editable_acl() override = default;
491
493 Access_bitmask *granted_access,
494 bool any_combination_will_do) const override;
495};
496
497/** Singleton instance of PFS_editable_acl. */
499
500/**
501 Privileges for unknown tables.
502*/
504 public:
505 PFS_unknown_acl() = default;
506
507 ~PFS_unknown_acl() override = default;
508
510 Access_bitmask *granted_access,
511 bool any_combination_will_do) const override;
512};
513
514/** Singleton instance of PFS_unknown_acl. */
516
517/**
518 Privileges for world readable tables.
519*/
521 public:
523
524 ~PFS_readonly_world_acl() override = default;
526 Access_bitmask *save_priv,
527 bool any_combination_will_do) const override;
528};
529
530/** Singleton instance of PFS_readonly_world_acl */
532
533/**
534Privileges for world readable truncatable tables.
535*/
537 public:
539
540 ~PFS_truncatable_world_acl() override = default;
542 Access_bitmask *save_priv,
543 bool any_combination_will_do) const override;
544};
545
546/** Singleton instance of PFS_readonly_world_acl */
548
549/**
550 Privileges for readable processlist tables.
551*/
553 public:
555
556 ~PFS_readonly_processlist_acl() override = default;
558 Access_bitmask *save_priv,
559 bool any_combination_will_do) const override;
560};
561
562/** Singleton instance of PFS_readonly_processlist_acl */
564
565/** Position of a cursor, for simple iterations. */
567 /** Current row index. */
569
570 /**
571 Constructor.
572 @param index the index initial value.
573 */
574 PFS_simple_index(uint index) : m_index(index) {}
575
576 /**
577 Set this index at a given position.
578 @param index an index
579 */
580 void set_at(uint index) { m_index = index; }
581
582 /**
583 Set this index at a given position.
584 @param other a position
585 */
586 void set_at(const PFS_simple_index *other) { m_index = other->m_index; }
587
588 /**
589 Set this index after a given position.
590 @param other a position
591 */
592 void set_after(const PFS_simple_index *other) {
593 m_index = other->m_index + 1;
594 }
595
596 /** Set this index to the next record. */
597 void next() { m_index++; }
598};
599
600/** Position of a double cursor, for iterations using 2 nested loops. */
602 /** Outer index. */
604 /** Current index within index_1. */
606
607 /**
608 Constructor.
609 @param index_1 the first index initial value.
610 @param index_2 the second index initial value.
611 */
612 PFS_double_index(uint index_1, uint index_2)
613 : m_index_1(index_1), m_index_2(index_2) {}
614
615 /**
616 Set this index at a given position.
617 */
618 void set_at(uint index_1, uint index_2) {
619 m_index_1 = index_1;
620 m_index_2 = index_2;
621 }
622
623 /**
624 Set this index at a given position.
625 @param other a position
626 */
627 void set_at(const PFS_double_index *other) {
628 m_index_1 = other->m_index_1;
629 m_index_2 = other->m_index_2;
630 }
631
632 /**
633 Set this index after a given position.
634 @param other a position
635 */
636 void set_after(const PFS_double_index *other) {
637 m_index_1 = other->m_index_1;
638 m_index_2 = other->m_index_2 + 1;
639 }
640};
641
642/** Position of a triple cursor, for iterations using 3 nested loops. */
644 /** Outer index. */
646 /** Current index within index_1. */
648 /** Current index within index_2. */
650
651 /**
652 Constructor.
653 @param index_1 the first index initial value.
654 @param index_2 the second index initial value.
655 @param index_3 the third index initial value.
656 */
657 PFS_triple_index(uint index_1, uint index_2, uint index_3)
658 : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3) {}
659
660 /**
661 Set this index at a given position.
662 */
663 void set_at(uint index_1, uint index_2, uint index_3) {
664 m_index_1 = index_1;
665 m_index_2 = index_2;
666 m_index_3 = index_3;
667 }
668
669 /**
670 Set this index at a given position.
671 @param other a position
672 */
673 void set_at(const PFS_triple_index *other) {
674 m_index_1 = other->m_index_1;
675 m_index_2 = other->m_index_2;
676 m_index_3 = other->m_index_3;
677 }
678
679 /**
680 Set this index after a given position.
681 @param other a position
682 */
683 void set_after(const PFS_triple_index *other) {
684 m_index_1 = other->m_index_1;
685 m_index_2 = other->m_index_2;
686 m_index_3 = other->m_index_3 + 1;
687 }
688};
689
690/** @} */
691
692#endif
uint32_t Access_bitmask
Definition: auth_acls.h:34
ACL_internal_access_result
Definition: auth_common.h:85
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Per internal table ACL access rules.
Definition: auth_common.h:107
Definition: field.h:577
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:486
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:552
~PFS_readonly_processlist_acl() override=default
Privileges for world readable tables.
Definition: pfs_engine_table.h:520
~PFS_readonly_world_acl() override=default
PFS_readonly_world_acl()=default
Privileges for truncatable tables.
Definition: pfs_engine_table.h:450
PFS_truncatable_acl()=default
~PFS_truncatable_acl() override=default
Privileges for world readable truncatable tables.
Definition: pfs_engine_table.h:536
PFS_truncatable_world_acl()=default
~PFS_truncatable_world_acl() override=default
Privileges for unknown tables.
Definition: pfs_engine_table.h:503
PFS_unknown_acl()=default
~PFS_unknown_acl() override=default
Privileges for updatable tables.
Definition: pfs_engine_table.h:468
~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:1328
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1096
int delete_row(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row from this table.
Definition: pfs_engine_table.cc:790
static void delete_all_locks()
Delete all the table share locks.
Definition: pfs_engine_table.cc:657
ha_rows(* pfs_get_row_count_t)()
Callback to get a row count.
Definition: pfs_engine_table.h:191
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1069
enum ha_rkey_function read_uint8(enum ha_rkey_function find_flag, bool &isnull, uchar *value)
Definition: pfs_engine_table.cc:1303
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:833
enum ha_rkey_function read_ulong(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1333
void get_position(void *ref)
Get the position of the current row.
Definition: pfs_engine_table.cc:811
int read_row(TABLE *table, unsigned char *buf, Field **fields)
Read a table row.
Definition: pfs_engine_table.cc:742
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
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1217
ha_rows get_row_count() const
Get the row count.
Definition: pfs_engine_table.cc:665
PFS_readonly_world_acl pfs_readonly_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1067
static void init_all_locks()
Initialize all the table share locks.
Definition: pfs_engine_table.cc:648
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:1430
enum ha_rkey_function read_int8(enum ha_rkey_function find_flag, bool &isnull, char *value)
Definition: pfs_engine_table.cc:1298
void set_position(const void *ref)
Set the table cursor at a given position.
Definition: pfs_engine_table.cc:819
static PFS_engine_table_share * find_engine_table_share(const char *name)
Find a table share by name.
Definition: pfs_engine_table.cc:714
PFS_truncatable_acl pfs_truncatable_acl
Singleton instance of PFS_truncatable_acl.
Definition: pfs_engine_table.cc:1094
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:823
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:1378
enum ha_rkey_function read_longlong(enum ha_rkey_function find_flag, bool &isnull, longlong *value)
Definition: pfs_engine_table.cc:1338
int write_row(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf, Field **fields) const
Write a row.
Definition: pfs_engine_table.cc:669
enum ha_rkey_function read_uint24(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1323
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1148
void init_mutex()
Definition: pfs_engine_table.cc:624
enum ha_rkey_function read_timestamp(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value, uint dec)
Definition: pfs_engine_table.cc:1348
enum ha_rkey_function read_ulonglong(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value)
Definition: pfs_engine_table.cc:1343
PFS_truncatable_world_acl pfs_truncatable_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1133
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1135
PFS_updatable_acl pfs_updatable_acl
Singleton instance of PFS_updatable_acl.
Definition: pfs_engine_table.cc:1146
PFS_readonly_acl pfs_readonly_acl
Singleton instance of PFS_readonly_acl.
Definition: pfs_engine_table.cc:1035
void remove_share(PFS_engine_table_share *share)
Remove a share from the list.
Definition: pfs_engine_table.cc:894
PFS_readonly_processlist_acl pfs_readonly_processlist_acl
Singleton instance of PFS_readonly_processlist_acl.
Definition: pfs_engine_table.cc:1080
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:778
PFS_editable_acl pfs_editable_acl
Singleton instance of PFS_editable_acl.
Definition: pfs_engine_table.cc:1177
void read_key(const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: pfs_engine_table.cc:1484
void destroy_mutex()
Definition: pfs_engine_table.cc:632
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1037
static void get_all_tables(List< const Plugin_table > *tables)
Get all the core performance schema tables.
Definition: pfs_engine_table.cc:639
virtual int delete_row_values(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row.
Definition: pfs_engine_table.cc:802
enum ha_rkey_function read_uint16(enum ha_rkey_function find_flag, bool &isnull, ushort *value)
Definition: pfs_engine_table.cc:1313
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *granted_access, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1179
PFS_unknown_acl pfs_unknown_acl
Singleton instance of PFS_unknown_acl.
Definition: pfs_engine_table.cc:1215
enum ha_rkey_function read_int16(enum ha_rkey_function find_flag, bool &isnull, short *value)
Definition: pfs_engine_table.cc:1308
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:875
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1082
enum ha_rkey_function read_int24(enum ha_rkey_function find_flag, bool &isnull, long *value)
Definition: pfs_engine_table.cc:1318
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:864
PFS_dynamic_table_shares pfs_external_table_shares
Definition: pfs_engine_table.cc:636
#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:601
void set_after(const PFS_double_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:636
void set_at(uint index_1, uint index_2)
Set this index at a given position.
Definition: pfs_engine_table.h:618
PFS_double_index(uint index_1, uint index_2)
Constructor.
Definition: pfs_engine_table.h:612
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:603
void set_at(const PFS_double_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:627
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:605
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:566
PFS_simple_index(uint index)
Constructor.
Definition: pfs_engine_table.h:574
void set_at(const PFS_simple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:586
void set_at(uint index)
Set this index at a given position.
Definition: pfs_engine_table.h:580
void set_after(const PFS_simple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:592
void next()
Set this index to the next record.
Definition: pfs_engine_table.h:597
uint m_index
Current row index.
Definition: pfs_engine_table.h:568
Position of a triple cursor, for iterations using 3 nested loops.
Definition: pfs_engine_table.h:643
void set_at(const PFS_triple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:673
uint m_index_3
Current index within index_2.
Definition: pfs_engine_table.h:649
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:647
PFS_triple_index(uint index_1, uint index_2, uint index_3)
Constructor.
Definition: pfs_engine_table.h:657
void set_after(const PFS_triple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:683
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:645
void set_at(uint index_1, uint index_2, uint index_3)
Set this index at a given position.
Definition: pfs_engine_table.h:663
Definition: table.h:1407
Definition: thr_lock.h:139
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
A time normalizer.
Definition: pfs_timer.h:119