MySQL 8.0.29
Source Code Documentation
pfs_engine_table.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef 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(void) = 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(void) = 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. */
185typedef int (*pfs_write_row_t)(PFS_engine_table *pfs_table, TABLE *table,
186 unsigned char *buf, Field **fields);
187/** Callback to delete all rows. */
188typedef int (*pfs_delete_all_rows_t)(void);
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:
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(void);
360 static void delete_all_locks(void);
361
362 /** Get the row count. */
363 ha_rows get_row_count(void) 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 return;
414 }
415
416 PFS_engine_table_share *find_share(const char *table_name, bool is_dead_too);
417
419
420 private:
421 std::vector<PFS_engine_table_share *> shares_vector;
423};
424
425/* List of table shares added by plugin/component */
427
428/**
429 Privileges for read only tables.
430 The only operation allowed is SELECT.
431*/
433 public:
434 PFS_readonly_acl() = default;
435
436 ~PFS_readonly_acl() override = default;
437
438 ACL_internal_access_result check(ulong want_access,
439 ulong *save_priv) const override;
440};
441
442/** Singleton instance of PFS_readonly_acl. */
444
445/**
446 Privileges for truncatable tables.
447 Operations allowed are SELECT and TRUNCATE.
448*/
450 public:
452
453 ~PFS_truncatable_acl() override = default;
454
455 ACL_internal_access_result check(ulong want_access,
456 ulong *save_priv) const override;
457};
458
459/** Singleton instance of PFS_truncatable_acl. */
461
462/**
463 Privileges for updatable tables.
464 Operations allowed are SELECT and UPDATE.
465*/
467 public:
468 PFS_updatable_acl() = default;
469
470 ~PFS_updatable_acl() override = default;
471
472 ACL_internal_access_result check(ulong want_access,
473 ulong *save_priv) const override;
474};
475
476/** Singleton instance of PFS_updatable_acl. */
478
479/**
480 Privileges for editable tables.
481 Operations allowed are SELECT, INSERT, UPDATE, DELETE and TRUNCATE.
482*/
484 public:
485 PFS_editable_acl() = default;
486
487 ~PFS_editable_acl() override = default;
488
489 ACL_internal_access_result check(ulong want_access,
490 ulong *save_priv) const override;
491};
492
493/** Singleton instance of PFS_editable_acl. */
495
496/**
497 Privileges for unknown tables.
498*/
500 public:
501 PFS_unknown_acl() = default;
502
503 ~PFS_unknown_acl() override = default;
504
505 ACL_internal_access_result check(ulong want_access,
506 ulong *save_priv) const override;
507};
508
509/** Singleton instance of PFS_unknown_acl. */
511
512/**
513 Privileges for world readable tables.
514*/
516 public:
518
519 ~PFS_readonly_world_acl() override = default;
520 ACL_internal_access_result check(ulong want_access,
521 ulong *save_priv) const override;
522};
523
524/** Singleton instance of PFS_readonly_world_acl */
526
527/**
528Privileges for world readable truncatable tables.
529*/
531 public:
533
534 ~PFS_truncatable_world_acl() override = default;
535 ACL_internal_access_result check(ulong want_access,
536 ulong *save_priv) const override;
537};
538
539/** Singleton instance of PFS_readonly_world_acl */
541
542/**
543 Privileges for readable processlist tables.
544*/
546 public:
548
549 ~PFS_readonly_processlist_acl() override = default;
550 ACL_internal_access_result check(ulong want_access,
551 ulong *save_priv) const override;
552};
553
554/** Singleton instance of PFS_readonly_processlist_acl */
556
557/** Position of a cursor, for simple iterations. */
559 /** Current row index. */
561
562 /**
563 Constructor.
564 @param index the index initial value.
565 */
566 PFS_simple_index(uint index) : m_index(index) {}
567
568 /**
569 Set this index at a given position.
570 @param index an index
571 */
572 void set_at(uint index) { m_index = index; }
573
574 /**
575 Set this index at a given position.
576 @param other a position
577 */
578 void set_at(const PFS_simple_index *other) { m_index = other->m_index; }
579
580 /**
581 Set this index after a given position.
582 @param other a position
583 */
584 void set_after(const PFS_simple_index *other) {
585 m_index = other->m_index + 1;
586 }
587
588 /** Set this index to the next record. */
589 void next(void) { m_index++; }
590};
591
592/** Position of a double cursor, for iterations using 2 nested loops. */
594 /** Outer index. */
596 /** Current index within index_1. */
598
599 /**
600 Constructor.
601 @param index_1 the first index initial value.
602 @param index_2 the second index initial value.
603 */
604 PFS_double_index(uint index_1, uint index_2)
605 : m_index_1(index_1), m_index_2(index_2) {}
606
607 /**
608 Set this index at a given position.
609 */
610 void set_at(uint index_1, uint index_2) {
611 m_index_1 = index_1;
612 m_index_2 = index_2;
613 }
614
615 /**
616 Set this index at a given position.
617 @param other a position
618 */
619 void set_at(const PFS_double_index *other) {
620 m_index_1 = other->m_index_1;
621 m_index_2 = other->m_index_2;
622 }
623
624 /**
625 Set this index after a given position.
626 @param other a position
627 */
628 void set_after(const PFS_double_index *other) {
629 m_index_1 = other->m_index_1;
630 m_index_2 = other->m_index_2 + 1;
631 }
632};
633
634/** Position of a triple cursor, for iterations using 3 nested loops. */
636 /** Outer index. */
638 /** Current index within index_1. */
640 /** Current index within index_2. */
642
643 /**
644 Constructor.
645 @param index_1 the first index initial value.
646 @param index_2 the second index initial value.
647 @param index_3 the third index initial value.
648 */
649 PFS_triple_index(uint index_1, uint index_2, uint index_3)
650 : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3) {}
651
652 /**
653 Set this index at a given position.
654 */
655 void set_at(uint index_1, uint index_2, uint index_3) {
656 m_index_1 = index_1;
657 m_index_2 = index_2;
658 m_index_3 = index_3;
659 }
660
661 /**
662 Set this index at a given position.
663 @param other a position
664 */
665 void set_at(const PFS_triple_index *other) {
666 m_index_1 = other->m_index_1;
667 m_index_2 = other->m_index_2;
668 m_index_3 = other->m_index_3;
669 }
670
671 /**
672 Set this index after a given position.
673 @param other a position
674 */
675 void set_after(const PFS_triple_index *other) {
676 m_index_1 = other->m_index_1;
677 m_index_2 = other->m_index_2;
678 m_index_3 = other->m_index_3 + 1;
679 }
680};
681
682/** @} */
683
684#endif
ACL_internal_access_result
Definition: auth_common.h:80
Per internal table ACL access rules.
Definition: auth_common.h:102
Definition: field.h:573
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:422
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:421
void unlock_share_list()
Definition: pfs_engine_table.h:408
Privileges for editable tables.
Definition: pfs_engine_table.h:483
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()
Definition: pfs_engine_table.h:285
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.
virtual void reset_position(void)=0
Reset the cursor position to the beginning of the table.
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 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 rnd_next(void)=0
Fetch the next row in this cursor.
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:432
~PFS_readonly_acl() override=default
PFS_readonly_acl()=default
Privileges for readable processlist tables.
Definition: pfs_engine_table.h:545
~PFS_readonly_processlist_acl() override=default
Privileges for world readable tables.
Definition: pfs_engine_table.h:515
~PFS_readonly_world_acl() override=default
PFS_readonly_world_acl()=default
Privileges for truncatable tables.
Definition: pfs_engine_table.h:449
PFS_truncatable_acl()=default
~PFS_truncatable_acl() override=default
Privileges for world readable truncatable tables.
Definition: pfs_engine_table.h:530
PFS_truncatable_world_acl()=default
~PFS_truncatable_world_acl() override=default
Privileges for unknown tables.
Definition: pfs_engine_table.h:499
PFS_unknown_acl()=default
~PFS_unknown_acl() override=default
Privileges for updatable tables.
Definition: pfs_engine_table.h:466
~PFS_updatable_acl() override=default
PFS_updatable_acl()=default
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:49
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:56
char * pos
Definition: do_ctype.cc:76
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:1253
int(* pfs_delete_all_rows_t)(void)
Callback to delete all rows.
Definition: pfs_engine_table.h:188
int delete_row(TABLE *table, const unsigned char *buf, Field **fields)
Delete a row from this table.
Definition: pfs_engine_table.cc:781
enum ha_rkey_function read_uint8(enum ha_rkey_function find_flag, bool &isnull, uchar *value)
Definition: pfs_engine_table.cc:1228
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:1258
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 *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1123
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
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1111
PFS_readonly_world_acl pfs_readonly_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1048
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:1355
enum ha_rkey_function read_int8(enum ha_rkey_function find_flag, bool &isnull, char *value)
Definition: pfs_engine_table.cc:1223
static void init_all_locks(void)
Initialize all the table share locks.
Definition: pfs_engine_table.cc:639
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:1087
ha_rows get_row_count(void) const
Get the row count.
Definition: pfs_engine_table.cc:656
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1159
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1138
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:1303
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1034
static void delete_all_locks(void)
Delete all the table share locks.
Definition: pfs_engine_table.cc:648
enum ha_rkey_function read_longlong(enum ha_rkey_function find_flag, bool &isnull, longlong *value)
Definition: pfs_engine_table.cc:1263
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:1248
void init_mutex()
Definition: pfs_engine_table.cc:615
enum ha_rkey_function read_timestamp(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value, uint dec)
Definition: pfs_engine_table.cc:1273
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1062
enum ha_rkey_function read_ulonglong(enum ha_rkey_function find_flag, bool &isnull, ulonglong *value)
Definition: pfs_engine_table.cc:1268
ha_rows(* pfs_get_row_count_t)(void)
Callback to get a row count.
Definition: pfs_engine_table.h:190
PFS_truncatable_world_acl pfs_truncatable_world_acl
Singleton instance of PFS_readonly_world_acl.
Definition: pfs_engine_table.cc:1109
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1089
PFS_updatable_acl pfs_updatable_acl
Singleton instance of PFS_updatable_acl.
Definition: pfs_engine_table.cc:1121
PFS_readonly_acl pfs_readonly_acl
Singleton instance of PFS_readonly_acl.
Definition: pfs_engine_table.cc:1032
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:1060
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:1136
void read_key(const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: pfs_engine_table.cc:1411
ACL_internal_access_result check(ulong want_access, ulong *save_priv) const override
Check access to an internal table.
Definition: pfs_engine_table.cc:1050
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:1238
PFS_unknown_acl pfs_unknown_acl
Singleton instance of PFS_unknown_acl.
Definition: pfs_engine_table.cc:1157
enum ha_rkey_function read_int16(enum ha_rkey_function find_flag, bool &isnull, short *value)
Definition: pfs_engine_table.cc:1233
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:1243
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
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:391
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:593
void set_after(const PFS_double_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:628
void set_at(uint index_1, uint index_2)
Set this index at a given position.
Definition: pfs_engine_table.h:610
PFS_double_index(uint index_1, uint index_2)
Constructor.
Definition: pfs_engine_table.h:604
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:595
void set_at(const PFS_double_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:619
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:597
A structure to keep callback functions to be implemented by plugin/component.
Definition: pfs_plugin_table_service.h:394
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
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
ha_base_keytype get_key_type(void)
Definition: pfs_engine_table.h:250
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:558
PFS_simple_index(uint index)
Constructor.
Definition: pfs_engine_table.h:566
void set_at(const PFS_simple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:578
void set_at(uint index)
Set this index at a given position.
Definition: pfs_engine_table.h:572
void set_after(const PFS_simple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:584
void next(void)
Set this index to the next record.
Definition: pfs_engine_table.h:589
uint m_index
Current row index.
Definition: pfs_engine_table.h:560
Position of a triple cursor, for iterations using 3 nested loops.
Definition: pfs_engine_table.h:635
void set_at(const PFS_triple_index *other)
Set this index at a given position.
Definition: pfs_engine_table.h:665
uint m_index_3
Current index within index_2.
Definition: pfs_engine_table.h:641
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:639
PFS_triple_index(uint index_1, uint index_2, uint index_3)
Constructor.
Definition: pfs_engine_table.h:649
void set_after(const PFS_triple_index *other)
Set this index after a given position.
Definition: pfs_engine_table.h:675
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:637
void set_at(uint index_1, uint index_2, uint index_3)
Set this index at a given position.
Definition: pfs_engine_table.h:655
Definition: table.h:1394
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: uca-dump.cc:29