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