MySQL 8.0.40
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:
297 KEY *m_key_info{nullptr};
299};
300
302 public:
304 : m_key_ptr_1(key_1),
309
311 : m_key_ptr_1(key_1),
312 m_key_ptr_2(key_2),
316
318 PFS_engine_key *key_3)
319 : m_key_ptr_1(key_1),
320 m_key_ptr_2(key_2),
321 m_key_ptr_3(key_3),
324
326 PFS_engine_key *key_3, PFS_engine_key *key_4)
327 : m_key_ptr_1(key_1),
328 m_key_ptr_2(key_2),
329 m_key_ptr_3(key_3),
330 m_key_ptr_4(key_4),
332
334 PFS_engine_key *key_3, PFS_engine_key *key_4,
335 PFS_engine_key *key_5)
336 : m_key_ptr_1(key_1),
337 m_key_ptr_2(key_2),
338 m_key_ptr_3(key_3),
339 m_key_ptr_4(key_4),
340 m_key_ptr_5(key_5) {}
341
342 ~PFS_engine_index() override = default;
343
344 void read_key(const uchar *key, uint key_len,
345 enum ha_rkey_function find_flag) override;
346
352};
353
354/**
355
356 A PERFORMANCE_SCHEMA table share.
357 This data is shared by all the table handles opened on the same table.
358*/
360 static void get_all_tables(List<const Plugin_table> *tables);
361 static void init_all_locks();
362 static void delete_all_locks();
363
364 /** Get the row count. */
365 ha_rows get_row_count() const;
366 /** Write a row. */
367 int write_row(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf,
368 Field **fields) const;
369 /** Table Access Control List. */
371 /** Open table function. */
373 /** Write row function. */
375 /** Delete all rows function. */
377 /** Get rows count function. */
379 /** Length of the @c m_pos position structure. */
381 /** The lock, stored on behalf of the SQL layer. */
383 /** Table definition. */
385 /** Table is available even if the Performance Schema is disabled. */
387
388 /* Interface to be implemented by plugin who adds its own table in PFS. */
390 /* Number of table objects using this share currently. */
391 std::atomic<int> m_ref_count;
392 /* is marked to be deleted? */
394};
395
396/**
397 * A class to keep list of table shares for non-native performance schema
398 * tables i.e. table created by plugins/components in performance schema.
399 */
401 public:
403
404 void init_mutex();
405
406 void destroy_mutex();
407
409
411
414 shares_vector.push_back(share);
415 }
416
417 PFS_engine_table_share *find_share(const char *table_name, bool is_dead_too);
418
420
421 private:
422 std::vector<PFS_engine_table_share *> shares_vector;
424};
425
426/* List of table shares added by plugin/component */
428
429/**
430 Privileges for read only tables.
431 The only operation allowed is SELECT.
432*/
434 public:
435 PFS_readonly_acl() = default;
436
437 ~PFS_readonly_acl() override = default;
438
440 Access_bitmask *granted_access,
441 bool any_combination_will_do) const override;
442};
443
444/** Singleton instance of PFS_readonly_acl. */
446
447/**
448 Privileges for truncatable tables.
449 Operations allowed are SELECT and TRUNCATE.
450*/
452 public:
454
455 ~PFS_truncatable_acl() override = default;
456
458 Access_bitmask *granted_access,
459 bool any_combination_will_do) const override;
460};
461
462/** Singleton instance of PFS_truncatable_acl. */
464
465/**
466 Privileges for updatable tables.
467 Operations allowed are SELECT and UPDATE.
468*/
470 public:
471 PFS_updatable_acl() = default;
472
473 ~PFS_updatable_acl() override = default;
474
476 Access_bitmask *granted_access,
477 bool any_combination_will_do) const override;
478};
479
480/** Singleton instance of PFS_updatable_acl. */
482
483/**
484 Privileges for editable tables.
485 Operations allowed are SELECT, INSERT, UPDATE, DELETE and TRUNCATE.
486*/
488 public:
489 PFS_editable_acl() = default;
490
491 ~PFS_editable_acl() override = default;
492
494 Access_bitmask *granted_access,
495 bool any_combination_will_do) const override;
496};
497
498/** Singleton instance of PFS_editable_acl. */
500
501/**
502 Privileges for unknown tables.
503*/
505 public:
506 PFS_unknown_acl() = default;
507
508 ~PFS_unknown_acl() override = default;
509
511 Access_bitmask *granted_access,
512 bool any_combination_will_do) const override;
513};
514
515/** Singleton instance of PFS_unknown_acl. */
517
518/**
519 Privileges for world readable tables.
520*/
522 public:
524
525 ~PFS_readonly_world_acl() override = default;
527 Access_bitmask *save_priv,
528 bool any_combination_will_do) const override;
529};
530
531/** Singleton instance of PFS_readonly_world_acl */
533
534/**
535Privileges for world readable truncatable tables.
536*/
538 public:
540
541 ~PFS_truncatable_world_acl() override = default;
543 Access_bitmask *save_priv,
544 bool any_combination_will_do) const override;
545};
546
547/** Singleton instance of PFS_readonly_world_acl */
549
550/**
551 Privileges for readable processlist tables.
552*/
554 public:
556
557 ~PFS_readonly_processlist_acl() override = default;
559 Access_bitmask *save_priv,
560 bool any_combination_will_do) const override;
561};
562
563/** Singleton instance of PFS_readonly_processlist_acl */
565
566/** Position of a cursor, for simple iterations. */
568 /** Current row index. */
570
571 /**
572 Constructor.
573 @param index the index initial value.
574 */
575 PFS_simple_index(uint index) : m_index(index) {}
576
577 /**
578 Set this index at a given position.
579 @param index an index
580 */
581 void set_at(uint index) { m_index = index; }
582
583 /**
584 Set this index at a given position.
585 @param other a position
586 */
587 void set_at(const PFS_simple_index *other) { m_index = other->m_index; }
588
589 /**
590 Set this index after a given position.
591 @param other a position
592 */
593 void set_after(const PFS_simple_index *other) {
594 m_index = other->m_index + 1;
595 }
596
597 /** Set this index to the next record. */
598 void next() { m_index++; }
599};
600
601/** Position of a double cursor, for iterations using 2 nested loops. */
603 /** Outer index. */
605 /** Current index within index_1. */
607
608 /**
609 Constructor.
610 @param index_1 the first index initial value.
611 @param index_2 the second index initial value.
612 */
613 PFS_double_index(uint index_1, uint index_2)
614 : m_index_1(index_1), m_index_2(index_2) {}
615
616 /**
617 Set this index at a given position.
618 */
619 void set_at(uint index_1, uint index_2) {
620 m_index_1 = index_1;
621 m_index_2 = index_2;
622 }
623
624 /**
625 Set this index at a given position.
626 @param other a position
627 */
628 void set_at(const PFS_double_index *other) {
629 m_index_1 = other->m_index_1;
630 m_index_2 = other->m_index_2;
631 }
632
633 /**
634 Set this index after a given position.
635 @param other a position
636 */
637 void set_after(const PFS_double_index *other) {
638 m_index_1 = other->m_index_1;
639 m_index_2 = other->m_index_2 + 1;
640 }
641};
642
643/** Position of a triple cursor, for iterations using 3 nested loops. */
645 /** Outer index. */
647 /** Current index within index_1. */
649 /** Current index within index_2. */
651
652 /**
653 Constructor.
654 @param index_1 the first index initial value.
655 @param index_2 the second index initial value.
656 @param index_3 the third index initial value.
657 */
658 PFS_triple_index(uint index_1, uint index_2, uint index_3)
659 : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3) {}
660
661 /**
662 Set this index at a given position.
663 */
664 void set_at(uint index_1, uint index_2, uint index_3) {
665 m_index_1 = index_1;
666 m_index_2 = index_2;
667 m_index_3 = index_3;
668 }
669
670 /**
671 Set this index at a given position.
672 @param other a position
673 */
674 void set_at(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;
678 }
679
680 /**
681 Set this index after a given position.
682 @param other a position
683 */
684 void set_after(const PFS_triple_index *other) {
685 m_index_1 = other->m_index_1;
686 m_index_2 = other->m_index_2;
687 m_index_3 = other->m_index_3 + 1;
688 }
689};
690
691/** @} */
692
693#endif
uint32_t Access_bitmask
Definition: auth_acls.h:34
ACL_internal_access_result
Definition: auth_common.h:85
Per internal table ACL access rules.
Definition: auth_common.h:107
Definition: field.h:575
Definition: key.h:57
uint8 type
Definition: key.h:73
Definition: key.h:113
Definition: sql_list.h:434
A class to keep list of table shares for non-native performance schema tables i.e.
Definition: pfs_engine_table.h:400
void lock_share_list()
Definition: pfs_engine_table.h:408
mysql_mutex_t LOCK_pfs_share_list
Definition: pfs_engine_table.h:423
void add_share(PFS_engine_table_share *share)
Definition: pfs_engine_table.h:412
PFS_dynamic_table_shares()=default
std::vector< PFS_engine_table_share * > shares_vector
Definition: pfs_engine_table.h:422
void unlock_share_list()
Definition: pfs_engine_table.h:410
Privileges for editable tables.
Definition: pfs_engine_table.h:487
PFS_editable_acl()=default
~PFS_editable_acl() override=default
Definition: pfs_engine_table.h:284
size_t m_key_fetch_count
Definition: pfs_engine_table.h:298
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:301
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:325
PFS_engine_key * m_key_ptr_2
Definition: pfs_engine_table.h:348
PFS_engine_key * m_key_ptr_4
Definition: pfs_engine_table.h:350
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: pfs_engine_table.h:310
~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:333
PFS_engine_key * m_key_ptr_5
Definition: pfs_engine_table.h:351
PFS_engine_index(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3)
Definition: pfs_engine_table.h:317
PFS_engine_key * m_key_ptr_3
Definition: pfs_engine_table.h:349
PFS_engine_key * m_key_ptr_1
Definition: pfs_engine_table.h:347
PFS_engine_index(PFS_engine_key *key_1)
Definition: pfs_engine_table.h:303
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:433
~PFS_readonly_acl() override=default
PFS_readonly_acl()=default
Privileges for readable processlist tables.
Definition: pfs_engine_table.h:553
~PFS_readonly_processlist_acl() override=default
Privileges for world readable tables.
Definition: pfs_engine_table.h:521
~PFS_readonly_world_acl() override=default
PFS_readonly_world_acl()=default
Privileges for truncatable tables.
Definition: pfs_engine_table.h:451
PFS_truncatable_acl()=default
~PFS_truncatable_acl() override=default
Privileges for world readable truncatable tables.
Definition: pfs_engine_table.h:537
PFS_truncatable_world_acl()=default
~PFS_truncatable_world_acl() override=default
Privileges for unknown tables.
Definition: pfs_engine_table.h:504
PFS_unknown_acl()=default
~PFS_unknown_acl() override=default
Privileges for updatable tables.
Definition: pfs_engine_table.h:469
~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
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
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:1319
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:1087
int delete_row(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row from this table.
Definition: pfs_engine_table.cc:782
static void delete_all_locks()
Delete all the table share locks.
Definition: pfs_engine_table.cc:649
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:1060
enum ha_rkey_function read_uint8(enum ha_rkey_function find_flag, bool &isnull, uchar *value)
Definition: pfs_engine_table.cc:1294
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:825
enum ha_rkey_function read_ulong(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1324
void get_position(void *ref)
Get the position of the current row.
Definition: pfs_engine_table.cc:803
int read_row(TABLE *table, unsigned char *buf, Field **fields)
Read a table row.
Definition: pfs_engine_table.cc:734
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:1208
ha_rows get_row_count() const
Get the row count.
Definition: pfs_engine_table.cc:657
PFS_readonly_world_acl pfs_readonly_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1058
static void init_all_locks()
Initialize all the table share locks.
Definition: pfs_engine_table.cc:640
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:1421
enum ha_rkey_function read_int8(enum ha_rkey_function find_flag, bool &isnull, char *value)
Definition: pfs_engine_table.cc:1289
void set_position(const void *ref)
Set the table cursor at a given position.
Definition: pfs_engine_table.cc:811
static PFS_engine_table_share * find_engine_table_share(const char *name)
Find a table share by name.
Definition: pfs_engine_table.cc:706
PFS_truncatable_acl pfs_truncatable_acl
Singleton instance of PFS_truncatable_acl.
Definition: pfs_engine_table.cc:1085
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:815
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:1369
enum ha_rkey_function read_longlong(enum ha_rkey_function find_flag, bool &isnull, longlong *value)
Definition: pfs_engine_table.cc:1329
int write_row(PFS_engine_table *pfs_table, TABLE *table, unsigned char *buf, Field **fields) const
Write a row.
Definition: pfs_engine_table.cc:661
enum ha_rkey_function read_uint24(enum ha_rkey_function find_flag, bool &isnull, ulong *value)
Definition: pfs_engine_table.cc:1314
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:1139
void init_mutex()
Definition: pfs_engine_table.cc:616
enum ha_rkey_function read_timestamp(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value, uint dec)
Definition: pfs_engine_table.cc:1339
enum ha_rkey_function read_ulonglong(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value)
Definition: pfs_engine_table.cc:1334
PFS_truncatable_world_acl pfs_truncatable_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1124
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:1126
PFS_updatable_acl pfs_updatable_acl
Singleton instance of PFS_updatable_acl.
Definition: pfs_engine_table.cc:1137
PFS_readonly_acl pfs_readonly_acl
Singleton instance of PFS_readonly_acl.
Definition: pfs_engine_table.cc:1026
void remove_share(PFS_engine_table_share *share)
Remove a share from the list.
Definition: pfs_engine_table.cc:885
PFS_readonly_processlist_acl pfs_readonly_processlist_acl
Singleton instance of PFS_readonly_processlist_acl.
Definition: pfs_engine_table.cc:1071
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:770
PFS_editable_acl pfs_editable_acl
Singleton instance of PFS_editable_acl.
Definition: pfs_engine_table.cc:1168
void read_key(const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: pfs_engine_table.cc:1475
void destroy_mutex()
Definition: pfs_engine_table.cc:624
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:1028
static void get_all_tables(List< const Plugin_table > *tables)
Get all the core performance schema tables.
Definition: pfs_engine_table.cc:631
virtual int delete_row_values(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row.
Definition: pfs_engine_table.cc:794
enum ha_rkey_function read_uint16(enum ha_rkey_function find_flag, bool &isnull, ushort *value)
Definition: pfs_engine_table.cc:1304
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:1170
PFS_unknown_acl pfs_unknown_acl
Singleton instance of PFS_unknown_acl.
Definition: pfs_engine_table.cc:1206
enum ha_rkey_function read_int16(enum ha_rkey_function find_flag, bool &isnull, short *value)
Definition: pfs_engine_table.cc:1299
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:866
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:1073
enum ha_rkey_function read_int24(enum ha_rkey_function find_flag, bool &isnull, long *value)
Definition: pfs_engine_table.cc:1309
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:855
PFS_dynamic_table_shares pfs_external_table_shares
Definition: pfs_engine_table.cc:628
#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:439
#define HA_ERR_UNSUPPORTED
unsupported extension used
Definition: my_base.h:854
ha_rkey_function
Definition: my_base.h:78
my_off_t ha_rows
Definition: my_base.h:1140
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.
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:420
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:33
Performance schema instrumentation (declarations).
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:602
void set_after(const PFS_double_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:637
void set_at(uint index_1, uint index_2)
Set this index at a given position.
Definition: pfs_engine_table.h:619
PFS_double_index(uint index_1, uint index_2)
Constructor.
Definition: pfs_engine_table.h:613
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:604
void set_at(const PFS_double_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:628
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:606
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:359
PFS_engine_table_proxy m_st_table
Definition: pfs_engine_table.h:389
std::atomic< int > m_ref_count
Definition: pfs_engine_table.h:391
bool m_in_purgatory
Definition: pfs_engine_table.h:393
const Plugin_table * m_table_def
Table definition.
Definition: pfs_engine_table.h:384
const ACL_internal_table_access * m_acl
Table Access Control List.
Definition: pfs_engine_table.h:370
pfs_write_row_t m_write_row
Write row function.
Definition: pfs_engine_table.h:374
uint m_ref_length
Length of the m_pos position structure.
Definition: pfs_engine_table.h:380
pfs_delete_all_rows_t m_delete_all_rows
Delete all rows function.
Definition: pfs_engine_table.h:376
pfs_get_row_count_t m_get_row_count
Get rows count function.
Definition: pfs_engine_table.h:378
THR_LOCK * m_thr_lock_ptr
The lock, stored on behalf of the SQL layer.
Definition: pfs_engine_table.h:382
pfs_open_table_t m_open_table
Open table function.
Definition: pfs_engine_table.h:372
bool m_perpetual
Table is available even if the Performance Schema is disabled.
Definition: pfs_engine_table.h:386
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:567
PFS_simple_index(uint index)
Constructor.
Definition: pfs_engine_table.h:575
void set_at(const PFS_simple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:587
void set_at(uint index)
Set this index at a given position.
Definition: pfs_engine_table.h:581
void set_after(const PFS_simple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:593
void next()
Set this index to the next record.
Definition: pfs_engine_table.h:598
uint m_index
Current row index.
Definition: pfs_engine_table.h:569
Position of a triple cursor, for iterations using 3 nested loops.
Definition: pfs_engine_table.h:644
void set_at(const PFS_triple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:674
uint m_index_3
Current index within index_2.
Definition: pfs_engine_table.h:650
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:648
PFS_triple_index(uint index_1, uint index_2, uint index_3)
Constructor.
Definition: pfs_engine_table.h:658
void set_after(const PFS_triple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:684
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:646
void set_at(uint index_1, uint index_2, uint index_3)
Set this index at a given position.
Definition: pfs_engine_table.h:664
Definition: table.h:1399
Definition: thr_lock.h:139
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
A time normalizer.
Definition: pfs_timer.h:119
unsigned int uint
Definition: uca9-dump.cc:75