MySQL 9.1.0
Source Code Documentation
pfs_data_lock.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 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_DATA_LOCK_H
25#define PFS_DATA_LOCK_H
26
27/**
28 @file storage/perfschema/pfs_data_lock.h
29 Performance schema instrumentation (declarations).
30*/
31
33#include <unordered_set>
34#include <vector>
35
36#include "my_compiler.h"
37#include "my_inttypes.h"
41
43 public:
44 static constexpr size_t max_len = 128;
45
47
48 void reset() {
49 memset(m_engine_lock_id, 0, sizeof(m_engine_lock_id));
51 }
52
53 void set(const pk_pos_data_lock *other) {
54 memcpy(m_engine_lock_id, other->m_engine_lock_id, sizeof(m_engine_lock_id));
56 }
57
58 void set(const char *str, size_t len) {
59 if ((len == 0) || (len > max_len) || (str == nullptr)) {
60 reset();
61 return;
62 }
63
64 memcpy(m_engine_lock_id, str, len);
65 if (len < max_len) {
66 memset(&m_engine_lock_id[len], 0, max_len - len);
67 }
68
70 }
71
72 const char *str() const { return m_engine_lock_id; }
73 size_t length() const { return m_engine_lock_id_length; }
74
75 private:
76 /** Column ENGINE_LOCK_ID */
79};
80
81// This structure is memcmp-ed, so we need to have no padding.
82static_assert(sizeof(pk_pos_data_lock) == 128 + sizeof(size_t));
83
84/** A row of table PERFORMANCE_SCHEMA.DATA_LOCKS. */
86 /** Column ENGINE */
87 const char *m_engine;
88 /** Column ENGINE_LOCK_ID */
90 /** Column ENGINE_TRANSACTION_ID */
92 /** Column THREAD_ID */
94 /** Column EVENT_ID */
96 /** Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME */
98 /** Column PARTITION_NAME */
99 const char *m_partition_name;
101 /** Column SUB_PARTITION_NAME */
104 /** Column OBJECT_INSTANCE_BEGIN */
105 const void *m_identity;
106 /** Column LOCK_MODE */
107 const char *m_lock_mode;
108 /** Column LOCK_TYPE */
109 const char *m_lock_type;
110 /** Column LOCK_STATUS */
111 const char *m_lock_status;
112 /** Column LOCK_DATA */
113 const char *m_lock_data;
114};
115
117 public:
118 static constexpr size_t max_len = 128;
119
121
122 void reset() {
123 // POT type, must initialize every byte for memcmp()
128 }
129
130 void set(const pk_pos_data_lock_wait *other) {
138 }
139
140 void set(const char *requesting_lock_id, size_t requesting_lock_id_length,
141 const char *blocking_lock_id, size_t blocking_lock_id_length) {
142 if ((requesting_lock_id_length == 0) ||
143 (requesting_lock_id_length > max_len) ||
144 (requesting_lock_id == nullptr) || (blocking_lock_id_length == 0) ||
145 (blocking_lock_id_length > max_len) || (blocking_lock_id == nullptr)) {
146 reset();
147 return;
148 }
149
150 // POT type, must initialize every byte for memcmp()
151
152 memcpy(m_requesting_engine_lock_id, requesting_lock_id,
153 requesting_lock_id_length);
154 if (requesting_lock_id_length < max_len) {
155 memset(&m_requesting_engine_lock_id[requesting_lock_id_length], 0,
156 max_len - requesting_lock_id_length);
157 }
158
159 m_requesting_engine_lock_id_length = requesting_lock_id_length;
160
161 memcpy(m_blocking_engine_lock_id, blocking_lock_id,
162 blocking_lock_id_length);
163 if (blocking_lock_id_length < max_len) {
164 memset(&m_blocking_engine_lock_id[blocking_lock_id_length], 0,
165 max_len - blocking_lock_id_length);
166 }
167
168 m_blocking_engine_lock_id_length = blocking_lock_id_length;
169 }
170
171 const char *get_requesting_lock_id() const {
173 }
174
177 }
178
179 const char *get_blocking_lock_id() const { return m_blocking_engine_lock_id; }
180
183 }
184
185 private:
186 /** Column REQUESTING_ENGINE_LOCK_ID */
189 /** Column BLOCKING_ENGINE_LOCK_ID */
192};
193
194// This structure is memcmp-ed, so we need to have no padding.
195static_assert(sizeof(pk_pos_data_lock_wait) == 2 * (128 + sizeof(size_t)));
196
197/** A row of table PERFORMANCE_SCHEMA.DATA_LOCK_WAITS. */
199 /** Column ENGINE */
200 const char *m_engine{nullptr};
201 /** Engine (REQUESTING_LOCK_ID, BLOCKING_LOCK_ID) key */
203 /** Column REQUESTING_ENGINE_TRANSACTION_ID */
205 /** Column REQUESTING_THREAD_ID */
207 /** Column REQUESTING_EVENT_ID */
209 /** Column REQUESTING_OBJECT_INSTANCE_BEGIN */
210 const void *m_requesting_identity{nullptr};
211 /** Column BLOCKING_ENGINE_TRANSACTION_ID */
213 /** Column BLOCKING_THREAD_ID */
215 /** Column BLOCKING_EVENT_ID */
217 /** Column BLOCKING_OBJECT_INSTANCE_BEGIN */
218 const void *m_blocking_identity{nullptr};
219};
220
222 public:
224 : PFS_engine_index(key_1, key_2) {}
225
227 PFS_engine_key *key_3, PFS_engine_key *key_4)
228 : PFS_engine_index(key_1, key_2, key_3, key_4) {}
229
230 ~PFS_index_data_locks() override = default;
231
232 virtual bool match_engine(const char *engine [[maybe_unused]],
233 size_t engine_length [[maybe_unused]]) {
234 return true;
235 }
236
237 virtual bool match_lock_id(const char *engine_lock_id [[maybe_unused]],
238 size_t engine_lock_id_length [[maybe_unused]]) {
239 return true;
240 }
241
242 virtual bool match_transaction_id(ulonglong engine_transaction_id
243 [[maybe_unused]]) {
244 return true;
245 }
246
247 virtual bool match_thread_id_event_id(ulonglong thread_id [[maybe_unused]],
248 ulonglong event_id [[maybe_unused]]) {
249 return true;
250 }
251
252 virtual bool match_object(const char *table_schema [[maybe_unused]],
253 size_t table_schema_length [[maybe_unused]],
254 const char *table_name [[maybe_unused]],
255 size_t table_name_length [[maybe_unused]],
256 const char *partition_name [[maybe_unused]],
257 size_t partition_name_length [[maybe_unused]],
258 const char *sub_partition_name [[maybe_unused]],
259 size_t sub_partition_name_length [[maybe_unused]]) {
260 return true;
261 }
262};
263
265 public:
268 m_key_1("ENGINE_LOCK_ID"),
269 m_key_2("ENGINE") {}
270
271 ~PFS_pk_data_locks() override = default;
272
274 if (m_fields >= 1) {
275 const char *key_value;
276 size_t key_value_length;
277 bool is_null;
278
279 /* Read the value of ENGINE_LOCK_ID. */
280 m_key_1.get_exact_key_value(is_null, key_value, key_value_length);
281 if (is_null) {
282 return nullptr;
283 }
284
285 /* Build a primary key with it. */
286 m_pk_pos.set(key_value, key_value_length);
287
288 /*
289 * IMPORTANT NOTE:
290 * We do not read the second field, ENGINE.
291 * See comments in table_data_locks::index_next()
292 */
293 return &m_pk_pos;
294 }
295
296 return nullptr;
297 }
298
299 bool match_lock_id(const char *engine_lock_id,
300 size_t engine_lock_id_length) override {
301 if (m_fields >= 1) {
302 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
303 return false;
304 }
305 }
306
307 return true;
308 }
309
310 bool match_engine(const char *engine, size_t engine_length) override {
311 if (m_fields >= 2) {
312 if (!m_key_2.match(engine, engine_length)) {
313 return false;
314 }
315 }
316
317 return true;
318 }
319
320 private:
324};
325
327 public:
330 m_key_1("ENGINE_TRANSACTION_ID"),
331 m_key_2("ENGINE") {}
332
334
335 bool match_transaction_id(ulonglong engine_transaction_id) override {
336 if (m_fields >= 1) {
337 if (!m_key_1.match(engine_transaction_id)) {
338 return false;
339 }
340 }
341
342 return true;
343 }
344
345 bool match_engine(const char *engine, size_t engine_length) override {
346 if (m_fields >= 2) {
347 if (!m_key_2.match(engine, engine_length)) {
348 return false;
349 }
350 }
351
352 return true;
353 }
354
355 private:
358};
359
361 public:
364 m_key_1("THREAD_ID"),
365 m_key_2("EVENT_ID") {}
366
368
370 ulonglong event_id) override {
371 if (m_fields >= 1) {
372 if (!m_key_1.match(thread_id)) {
373 return false;
374 }
375 }
376
377 if (m_fields >= 2) {
378 if (!m_key_2.match(event_id)) {
379 return false;
380 }
381 }
382
383 return true;
384 }
385
386 private:
389};
390
392 public:
395 m_key_1("OBJECT_SCHEMA"),
396 m_key_2("OBJECT_NAME"),
397 m_key_3("PARTITION_NAME"),
398 m_key_4("SUBPARTITION_NAME") {}
399
401
402 bool match_object(const char *table_schema, size_t table_schema_length,
403 const char *table_name, size_t table_name_length,
404 const char *partition_name, size_t partition_name_length,
405 const char *sub_partition_name,
406 size_t sub_partition_name_length) override {
407 if (m_fields >= 1) {
408 if (!m_key_1.match(table_schema, table_schema_length)) {
409 return false;
410 }
411 }
412
413 if (m_fields >= 2) {
414 if (!m_key_2.match(table_name, table_name_length)) {
415 return false;
416 }
417 }
418
419 if (m_fields >= 3) {
420 if (!m_key_3.match(partition_name, partition_name_length)) {
421 return false;
422 }
423 }
424
425 if (m_fields >= 4) {
426 if (!m_key_4.match(sub_partition_name, sub_partition_name_length)) {
427 return false;
428 }
429 }
430
431 return true;
432 }
433
434 private:
439};
440
442 public:
444 : PFS_engine_index(key_1, key_2) {}
445
447 PFS_engine_key *key_3)
448 : PFS_engine_index(key_1, key_2, key_3) {}
449
450 ~PFS_index_data_lock_waits() override = default;
451
452 virtual bool match_engine(const char *engine [[maybe_unused]],
453 size_t engine_length [[maybe_unused]]) {
454 return true;
455 }
456
457 virtual bool match_requesting_lock_id(const char *engine_lock_id
458 [[maybe_unused]],
459 size_t engine_lock_id_length
460 [[maybe_unused]]) {
461 return true;
462 }
463
464 virtual bool match_blocking_lock_id(const char *engine_lock_id
465 [[maybe_unused]],
466 size_t engine_lock_id_length
467 [[maybe_unused]]) {
468 return true;
469 }
470
471 virtual bool match_requesting_transaction_id(ulonglong engine_transaction_id
472 [[maybe_unused]]) {
473 return true;
474 }
475
476 virtual bool match_blocking_transaction_id(ulonglong engine_transaction_id
477 [[maybe_unused]]) {
478 return true;
479 }
480
482 [[maybe_unused]],
483 ulonglong event_id
484 [[maybe_unused]]) {
485 return true;
486 }
487
489 [[maybe_unused]],
490 ulonglong event_id
491 [[maybe_unused]]) {
492 return true;
493 }
494};
495
497 public:
500 m_key_1("REQUESTING_ENGINE_LOCK_ID"),
501 m_key_2("BLOCKING_ENGINE_LOCK_ID"),
502 m_key_3("ENGINE") {}
503
504 ~PFS_pk_data_lock_waits() override = default;
505
507 if (m_fields >= 2) {
508 const char *key_value_1;
509 size_t key_value_length_1;
510 bool is_null_1;
511 const char *key_value_2;
512 size_t key_value_length_2;
513 bool is_null_2;
514
515 /* Read the value of REQUESTING_ENGINE_LOCK_ID. */
516 m_key_1.get_exact_key_value(is_null_1, key_value_1, key_value_length_1);
517 if (is_null_1) {
518 return nullptr;
519 }
520
521 /* Read the value of BLOCKING_ENGINE_LOCK_ID. */
522 m_key_2.get_exact_key_value(is_null_2, key_value_2, key_value_length_2);
523 if (is_null_2) {
524 return nullptr;
525 }
526
527 /* Build a primary key with it. */
528 m_pk_pos.set(key_value_1, key_value_length_1, key_value_2,
529 key_value_length_2);
530
531 /*
532 * IMPORTANT NOTE:
533 * We do not read the third field, ENGINE.
534 * See comments in table_data_lock_waits::index_next()
535 */
536 return &m_pk_pos;
537 }
538
539 return nullptr;
540 }
541
542 bool match_requesting_lock_id(const char *engine_lock_id,
543 size_t engine_lock_id_length) override {
544 if (m_fields >= 1) {
545 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
546 return false;
547 }
548 }
549
550 return true;
551 }
552
553 bool match_blocking_lock_id(const char *engine_lock_id,
554 size_t engine_lock_id_length) override {
555 if (m_fields >= 2) {
556 if (!m_key_2.match(engine_lock_id, engine_lock_id_length)) {
557 return false;
558 }
559 }
560
561 return true;
562 }
563
564 bool match_engine(const char *engine, size_t engine_length) override {
565 if (m_fields >= 3) {
566 if (!m_key_3.match(engine, engine_length)) {
567 return false;
568 }
569 }
570
571 return true;
572 }
573
574 private:
579};
580
583 public:
586 m_key_1("REQUESTING_ENGINE_LOCK_ID"),
587 m_key_2("ENGINE") {}
588
590
591 bool match_requesting_lock_id(const char *engine_lock_id,
592 size_t engine_lock_id_length) override {
593 if (m_fields >= 1) {
594 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
595 return false;
596 }
597 }
598
599 return true;
600 }
601
602 bool match_engine(const char *engine, size_t engine_length) override {
603 if (m_fields >= 2) {
604 if (!m_key_2.match(engine, engine_length)) {
605 return false;
606 }
607 }
608
609 return true;
610 }
611
612 private:
615};
616
619 public:
622 m_key_1("BLOCKING_ENGINE_LOCK_ID"),
623 m_key_2("ENGINE") {}
624
626
627 bool match_blocking_lock_id(const char *engine_lock_id,
628 size_t engine_lock_id_length) override {
629 if (m_fields >= 1) {
630 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
631 return false;
632 }
633 }
634
635 return true;
636 }
637
638 bool match_engine(const char *engine, size_t engine_length) override {
639 if (m_fields >= 2) {
640 if (!m_key_2.match(engine, engine_length)) {
641 return false;
642 }
643 }
644
645 return true;
646 }
647
648 private:
651};
652
655 public:
658 m_key_1("REQUESTING_ENGINE_TRANSACTION_ID"),
659 m_key_2("ENGINE") {}
660
662
664 ulonglong engine_transaction_id) override {
665 if (m_fields >= 1) {
666 if (!m_key_1.match(engine_transaction_id)) {
667 return false;
668 }
669 }
670
671 return true;
672 }
673
674 bool match_engine(const char *engine, size_t engine_length) override {
675 if (m_fields >= 2) {
676 if (!m_key_2.match(engine, engine_length)) {
677 return false;
678 }
679 }
680
681 return true;
682 }
683
684 private:
687};
688
691 public:
694 m_key_1("BLOCKING_ENGINE_TRANSACTION_ID"),
695 m_key_2("ENGINE") {}
696
698
699 bool match_blocking_transaction_id(ulonglong engine_transaction_id) override {
700 if (m_fields >= 1) {
701 if (!m_key_1.match(engine_transaction_id)) {
702 return false;
703 }
704 }
705
706 return true;
707 }
708
709 bool match_engine(const char *engine, size_t engine_length) override {
710 if (m_fields >= 2) {
711 if (!m_key_2.match(engine, engine_length)) {
712 return false;
713 }
714 }
715
716 return true;
717 }
718
719 private:
722};
723
726 public:
729 m_key_1("REQUESTING_THREAD_ID"),
730 m_key_2("REQUESTING_EVENT_ID") {}
731
733
735 ulonglong event_id) override {
736 if (m_fields >= 1) {
737 if (!m_key_1.match(thread_id)) {
738 return false;
739 }
740 }
741
742 if (m_fields >= 2) {
743 if (!m_key_2.match(event_id)) {
744 return false;
745 }
746 }
747
748 return true;
749 }
750
751 private:
754};
755
758 public:
761 m_key_1("BLOCKING_THREAD_ID"),
762 m_key_2("BLOCKING_EVENT_ID") {}
763
765
767 ulonglong event_id) override {
768 if (m_fields >= 1) {
769 if (!m_key_1.match(thread_id)) {
770 return false;
771 }
772 }
773
774 if (m_fields >= 2) {
775 if (!m_key_2.match(event_id)) {
776 return false;
777 }
778 }
779
780 return true;
781 }
782
783 private:
786};
787
788template <class T>
790 public:
793
795 : PFS_std_allocator<T>(other) {}
796
797 template <class U>
799 const PFS_data_container_allocator<U> &u) noexcept
801};
802
804 private:
805 typedef std::unordered_set<std::string, std::hash<std::string>,
806 std::equal_to<>,
809
811
812 public:
813 PFS_data_cache() = default;
814 ~PFS_data_cache() = default;
815
816 const char *cache_data(const char *ptr, size_t length) {
817 /*
818 std::string is just a sequence of bytes,
819 which actually can contain a 0 byte ...
820 Never use strlen() on the binary data.
821 */
822 const std::string key(ptr, length);
823 std::pair<set_type::iterator, bool> ret;
824
825 ret = m_set.insert(key);
826 return (*ret.first).data();
827 }
828
829 void clear() { m_set.clear(); }
830};
831
833 public:
836
837 const char *cache_string(const char *string) override;
838 const char *cache_data(const char *ptr, size_t length) override;
839 void cache_identifier(PSI_identifier kind, const char *str, size_t length,
840 const char **cached_ptr,
841 size_t *cached_length) override;
842
843 bool accept_engine(const char *engine, size_t engine_length) override;
844 bool accept_lock_id(const char *engine_lock_id,
845 size_t engine_lock_id_length) override;
846 bool accept_transaction_id(ulonglong transaction_id) override;
848 ulonglong event_id) override;
849 bool accept_object(const char *table_schema, size_t table_schema_length,
850 const char *table_name, size_t table_name_length,
851 const char *partition_name, size_t partition_name_length,
852 const char *sub_partition_name,
853 size_t sub_partition_name_length) override;
854
855 void add_lock_row(const char *engine, size_t engine_length,
856 const char *engine_lock_id, size_t engine_lock_id_length,
857 ulonglong transaction_id, ulonglong thread_id,
858 ulonglong event_id, const char *table_schema,
859 size_t table_schema_length, const char *table_name,
860 size_t table_name_length, const char *partition_name,
861 size_t partition_name_length,
862 const char *sub_partition_name,
863 size_t sub_partition_name_length, const char *index_name,
864 size_t index_name_length, const void *identity,
865 const char *lock_mode, const char *lock_type,
866 const char *lock_status, const char *lock_data) override;
867
868 /**
869 Clear the container.
870 New rows added will start at index 0.
871 */
872 void clear();
873 /**
874 Shrink the container.
875 New rows added will continue to use the current index.
876 */
877 void shrink();
878 row_data_lock *get_row(size_t index);
879
880 void set_filter(PFS_index_data_locks *filter) { m_filter = filter; }
881
882 private:
884 std::vector<row_data_lock, PFS_data_container_allocator<row_data_lock>>
888};
889
892 public:
895
896 const char *cache_string(const char *string) override;
897 const char *cache_data(const char *ptr, size_t length) override;
898
899 bool accept_engine(const char *engine, size_t engine_length) override;
900 bool accept_requesting_lock_id(const char *engine_lock_id,
901 size_t engine_lock_id_length) override;
902 bool accept_blocking_lock_id(const char *engine_lock_id,
903 size_t engine_lock_id_length) override;
904 bool accept_requesting_transaction_id(ulonglong transaction_id) override;
905 bool accept_blocking_transaction_id(ulonglong transaction_id) override;
907 ulonglong event_id) override;
909 ulonglong event_id) override;
910
912 const char *engine, size_t engine_length,
913 const char *requesting_engine_lock_id,
914 size_t requesting_engine_lock_id_length,
915 ulonglong requesting_transaction_id, ulonglong requesting_thread_id,
916 ulonglong requesting_event_id, const void *requesting_identity,
917 const char *blocking_engine_lock_id,
918 size_t blocking_engine_lock_id_length, ulonglong blocking_transaction_id,
919 ulonglong blocking_thread_id, ulonglong blocking_event_id,
920 const void *blocking_identity) override;
921
922 /**
923 Clear the container.
924 New rows added will start at index 0.
925 */
926 void clear();
927 /**
928 Shrink the container.
929 New rows added will continue to use the current index.
930 */
931 void shrink();
932 row_data_lock_wait *get_row(size_t index);
933
935
936 private:
943};
944
945#endif
Definition: pfs_data_lock.h:803
PFS_data_cache()=default
void clear()
Definition: pfs_data_lock.h:829
const char * cache_data(const char *ptr, size_t length)
Definition: pfs_data_lock.h:816
std::unordered_set< std::string, std::hash< std::string >, std::equal_to<>, PFS_data_container_allocator< std::string > > set_type
Definition: pfs_data_lock.h:808
set_type m_set
Definition: pfs_data_lock.h:810
~PFS_data_cache()=default
Definition: pfs_data_lock.h:789
constexpr PFS_data_container_allocator(const PFS_data_container_allocator< U > &u) noexcept
Definition: pfs_data_lock.h:798
PFS_data_container_allocator(const PFS_data_container_allocator &other)
Definition: pfs_data_lock.h:794
PFS_data_container_allocator()
Definition: pfs_data_lock.h:791
Definition: pfs_data_lock.h:832
void cache_identifier(PSI_identifier kind, const char *str, size_t length, const char **cached_ptr, size_t *cached_length) override
Add an identifier in the container cache.
Definition: pfs_data_lock.cc:200
std::vector< row_data_lock, PFS_data_container_allocator< row_data_lock > > m_rows
Definition: pfs_data_lock.h:885
PFS_data_lock_container()
Definition: pfs_data_lock.cc:186
bool accept_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Check if the container accepts data for a particular lock.
Definition: pfs_data_lock.cc:249
~PFS_data_lock_container() override
bool accept_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Check if the container accepts data for a particular event.
Definition: pfs_data_lock.cc:264
bool accept_engine(const char *engine, size_t engine_length) override
Check if the container accepts data for a particular engine.
Definition: pfs_data_lock.cc:241
void add_lock_row(const char *engine, size_t engine_length, const char *engine_lock_id, size_t engine_lock_id_length, ulonglong transaction_id, ulonglong thread_id, ulonglong event_id, const char *table_schema, size_t table_schema_length, const char *table_name, size_t table_name_length, const char *partition_name, size_t partition_name_length, const char *sub_partition_name, size_t sub_partition_name_length, const char *index_name, size_t index_name_length, const void *identity, const char *lock_mode, const char *lock_type, const char *lock_status, const char *lock_data) override
Add a row to table performance_schema.data_locks.
Definition: pfs_data_lock.cc:286
size_t m_logical_row_index
Definition: pfs_data_lock.h:883
bool accept_transaction_id(ulonglong transaction_id) override
Check if the container accepts data for a particular transaction.
Definition: pfs_data_lock.cc:257
void set_filter(PFS_index_data_locks *filter)
Definition: pfs_data_lock.h:880
const char * cache_string(const char *string) override
Add a string to the container cache.
Definition: pfs_data_lock.cc:191
void clear()
Clear the container.
Definition: pfs_data_lock.cc:336
PFS_index_data_locks * m_filter
Definition: pfs_data_lock.h:887
const char * cache_data(const char *ptr, size_t length) override
Add binary data to the container cache.
Definition: pfs_data_lock.cc:195
bool accept_object(const char *table_schema, size_t table_schema_length, const char *table_name, size_t table_name_length, const char *partition_name, size_t partition_name_length, const char *sub_partition_name, size_t sub_partition_name_length) override
Check if the container accepts data for a particular object.
Definition: pfs_data_lock.cc:272
row_data_lock * get_row(size_t index)
Definition: pfs_data_lock.cc:350
PFS_data_cache m_cache
Definition: pfs_data_lock.h:886
void shrink()
Shrink the container.
Definition: pfs_data_lock.cc:342
Definition: pfs_data_lock.h:891
void clear()
Clear the container.
Definition: pfs_data_lock.cc:471
row_data_lock_wait * get_row(size_t index)
Definition: pfs_data_lock.cc:485
PFS_data_cache m_cache
Definition: pfs_data_lock.h:941
void set_filter(PFS_index_data_lock_waits *filter)
Definition: pfs_data_lock.h:934
~PFS_data_lock_wait_container() override
bool accept_requesting_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Check if the container accepts data for a particular requesting event.
Definition: pfs_data_lock.cc:425
bool accept_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Check if the container accepts data for a particular blocking lock id.
Definition: pfs_data_lock.cc:400
PFS_data_lock_wait_container()
Definition: pfs_data_lock.cc:369
bool accept_requesting_transaction_id(ulonglong transaction_id) override
Check if the container accepts data for a particular requesting transaction id.
Definition: pfs_data_lock.cc:409
bool accept_requesting_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Check if the container accepts data for a particular requesting lock id.
Definition: pfs_data_lock.cc:391
const char * cache_string(const char *string) override
Definition: pfs_data_lock.cc:374
bool accept_blocking_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Check if the container accepts data for a particular blocking event.
Definition: pfs_data_lock.cc:433
bool accept_engine(const char *engine, size_t engine_length) override
Check if the container accepts data for a particular engine.
Definition: pfs_data_lock.cc:383
std::vector< row_data_lock_wait, PFS_data_container_allocator< row_data_lock_wait > > m_rows
Definition: pfs_data_lock.h:940
PFS_index_data_lock_waits * m_filter
Definition: pfs_data_lock.h:942
bool accept_blocking_transaction_id(ulonglong transaction_id) override
Check if the container accepts data for a particular blocking transaction id.
Definition: pfs_data_lock.cc:417
size_t m_logical_row_index
Definition: pfs_data_lock.h:937
void shrink()
Shrink the container.
Definition: pfs_data_lock.cc:477
void add_lock_wait_row(const char *engine, size_t engine_length, const char *requesting_engine_lock_id, size_t requesting_engine_lock_id_length, ulonglong requesting_transaction_id, ulonglong requesting_thread_id, ulonglong requesting_event_id, const void *requesting_identity, const char *blocking_engine_lock_id, size_t blocking_engine_lock_id_length, ulonglong blocking_transaction_id, ulonglong blocking_thread_id, ulonglong blocking_event_id, const void *blocking_identity) override
Add a row to table performance_schema.data_lock_waits.
Definition: pfs_data_lock.cc:441
const char * cache_data(const char *ptr, size_t length) override
Definition: pfs_data_lock.cc:378
uint m_fields
Definition: pfs_engine_table.h:296
Definition: pfs_engine_table.h:301
Definition: pfs_engine_table.h:268
Definition: pfs_data_lock.h:618
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:638
bool match_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:627
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:650
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:649
~PFS_index_data_lock_waits_by_blocking_lock_id() override=default
PFS_index_data_lock_waits_by_blocking_lock_id()
Definition: pfs_data_lock.h:620
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:785
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:784
PFS_index_data_lock_waits_by_blocking_thread_id()
Definition: pfs_data_lock.h:759
~PFS_index_data_lock_waits_by_blocking_thread_id() override=default
bool match_blocking_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Definition: pfs_data_lock.h:766
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:721
PFS_index_data_lock_waits_by_blocking_transaction_id()
Definition: pfs_data_lock.h:692
bool match_blocking_transaction_id(ulonglong engine_transaction_id) override
Definition: pfs_data_lock.h:699
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:709
~PFS_index_data_lock_waits_by_blocking_transaction_id() override=default
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:720
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:614
PFS_index_data_lock_waits_by_requesting_lock_id()
Definition: pfs_data_lock.h:584
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:613
~PFS_index_data_lock_waits_by_requesting_lock_id() override=default
bool match_requesting_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:591
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:602
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:752
~PFS_index_data_lock_waits_by_requesting_thread_id() override=default
bool match_requesting_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Definition: pfs_data_lock.h:734
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:753
PFS_index_data_lock_waits_by_requesting_thread_id()
Definition: pfs_data_lock.h:727
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:685
~PFS_index_data_lock_waits_by_requesting_transaction_id() override=default
bool match_requesting_transaction_id(ulonglong engine_transaction_id) override
Definition: pfs_data_lock.h:663
PFS_index_data_lock_waits_by_requesting_transaction_id()
Definition: pfs_data_lock.h:656
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:686
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:674
Definition: pfs_data_lock.h:441
virtual bool match_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length)
Definition: pfs_data_lock.h:464
virtual bool match_requesting_thread_id_event_id(ulonglong thread_id, ulonglong event_id)
Definition: pfs_data_lock.h:481
~PFS_index_data_lock_waits() override=default
virtual bool match_blocking_transaction_id(ulonglong engine_transaction_id)
Definition: pfs_data_lock.h:476
PFS_index_data_lock_waits(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: pfs_data_lock.h:443
virtual bool match_engine(const char *engine, size_t engine_length)
Definition: pfs_data_lock.h:452
virtual bool match_requesting_transaction_id(ulonglong engine_transaction_id)
Definition: pfs_data_lock.h:471
virtual bool match_blocking_thread_id_event_id(ulonglong thread_id, ulonglong event_id)
Definition: pfs_data_lock.h:488
virtual bool match_requesting_lock_id(const char *engine_lock_id, size_t engine_lock_id_length)
Definition: pfs_data_lock.h:457
PFS_index_data_lock_waits(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3)
Definition: pfs_data_lock.h:446
Definition: pfs_data_lock.h:391
bool match_object(const char *table_schema, size_t table_schema_length, const char *table_name, size_t table_name_length, const char *partition_name, size_t partition_name_length, const char *sub_partition_name, size_t sub_partition_name_length) override
Definition: pfs_data_lock.h:402
~PFS_index_data_locks_by_object() override=default
PFS_index_data_locks_by_object()
Definition: pfs_data_lock.h:393
PFS_key_object_name m_key_2
Definition: pfs_data_lock.h:436
PFS_key_object_schema m_key_1
Definition: pfs_data_lock.h:435
PFS_key_name m_key_4
Definition: pfs_data_lock.h:438
PFS_key_name m_key_3
Definition: pfs_data_lock.h:437
Definition: pfs_data_lock.h:360
PFS_index_data_locks_by_thread_id()
Definition: pfs_data_lock.h:362
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:387
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:388
~PFS_index_data_locks_by_thread_id() override=default
bool match_thread_id_event_id(ulonglong thread_id, ulonglong event_id) override
Definition: pfs_data_lock.h:369
Definition: pfs_data_lock.h:326
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:345
PFS_index_data_locks_by_transaction_id()
Definition: pfs_data_lock.h:328
bool match_transaction_id(ulonglong engine_transaction_id) override
Definition: pfs_data_lock.h:335
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:357
~PFS_index_data_locks_by_transaction_id() override=default
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:356
Definition: pfs_data_lock.h:221
PFS_index_data_locks(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: pfs_data_lock.h:223
virtual bool match_transaction_id(ulonglong engine_transaction_id)
Definition: pfs_data_lock.h:242
PFS_index_data_locks(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3, PFS_engine_key *key_4)
Definition: pfs_data_lock.h:226
~PFS_index_data_locks() override=default
virtual bool match_thread_id_event_id(ulonglong thread_id, ulonglong event_id)
Definition: pfs_data_lock.h:247
virtual bool match_object(const char *table_schema, size_t table_schema_length, const char *table_name, size_t table_name_length, const char *partition_name, size_t partition_name_length, const char *sub_partition_name, size_t sub_partition_name_length)
Definition: pfs_data_lock.h:252
virtual bool match_engine(const char *engine, size_t engine_length)
Definition: pfs_data_lock.h:232
virtual bool match_lock_id(const char *engine_lock_id, size_t engine_lock_id_length)
Definition: pfs_data_lock.h:237
Definition: table_helper.h:1614
bool match(const char *engine_lock_id, size_t length)
Definition: table_helper.cc:2217
Definition: table_helper.h:1604
bool match(const char *engine_name, size_t length)
Definition: table_helper.cc:2213
Definition: table_helper.h:1318
bool match(ulonglong engine_transaction_id)
Definition: table_helper.cc:1888
Definition: table_helper.h:1295
bool match(ulonglong event_id)
Definition: table_helper.cc:1853
Definition: table_helper.h:1569
bool match(const LEX_CSTRING *name)
Definition: table_helper.cc:2167
Definition: table_helper.h:1671
bool match(const PFS_table_share *share)
Definition: table_helper.cc:2420
Definition: table_helper.h:1656
bool match(const PFS_table_share *share)
Definition: table_helper.cc:2382
void get_exact_key_value(bool &is_null, const char *&key_value, size_t &key_value_length)
Definition: table_helper.h:1436
Definition: table_helper.h:1279
bool match(ulonglong thread_id)
Definition: table_helper.cc:1792
Definition: pfs_data_lock.h:496
PFS_key_engine_lock_id m_key_2
Definition: pfs_data_lock.h:576
~PFS_pk_data_lock_waits() override=default
pk_pos_data_lock_wait * get_pk()
Definition: pfs_data_lock.h:506
bool match_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:553
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:575
PFS_pk_data_lock_waits()
Definition: pfs_data_lock.h:498
pk_pos_data_lock_wait m_pk_pos
Definition: pfs_data_lock.h:578
bool match_requesting_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:542
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:564
PFS_key_engine_name m_key_3
Definition: pfs_data_lock.h:577
Definition: pfs_data_lock.h:264
bool match_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:299
pk_pos_data_lock m_pk_pos
Definition: pfs_data_lock.h:323
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:322
pk_pos_data_lock * get_pk()
Definition: pfs_data_lock.h:273
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:321
~PFS_pk_data_locks() override=default
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:310
PFS_pk_data_locks()
Definition: pfs_data_lock.h:266
Server interface, row lock container.
Definition: psi_data_lock.h:117
Definition: psi_data_lock.h:220
PSI_identifier
Definition: psi_data_lock.h:97
lock_mode
Definition: lock0types.h:54
Header for compiler-dependent features.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
static my_thread_id thread_id
Definition: my_thr_init.cc:63
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
const char * table_name
Definition: rules_table_service.cc:56
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
PFS_builtin_memory_class builtin_memory_data_container
Definition: pfs_builtin_memory.cc:131
Performance schema instruments metadata (declarations).
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Row fragment for columns OBJECT_TYPE, SCHEMA_NAME, OBJECT_NAME, INDEX_NAME.
Definition: table_helper.h:679
Definition: pfs_std_allocator.h:38
Definition: pfs_data_lock.h:116
pk_pos_data_lock_wait()
Definition: pfs_data_lock.h:120
size_t get_blocking_lock_id_length() const
Definition: pfs_data_lock.h:181
void reset()
Definition: pfs_data_lock.h:122
size_t m_blocking_engine_lock_id_length
Definition: pfs_data_lock.h:191
size_t get_requesting_lock_id_length() const
Definition: pfs_data_lock.h:175
char m_requesting_engine_lock_id[max_len]
Column REQUESTING_ENGINE_LOCK_ID.
Definition: pfs_data_lock.h:187
const char * get_blocking_lock_id() const
Definition: pfs_data_lock.h:179
void set(const pk_pos_data_lock_wait *other)
Definition: pfs_data_lock.h:130
const char * get_requesting_lock_id() const
Definition: pfs_data_lock.h:171
void set(const char *requesting_lock_id, size_t requesting_lock_id_length, const char *blocking_lock_id, size_t blocking_lock_id_length)
Definition: pfs_data_lock.h:140
static constexpr size_t max_len
Definition: pfs_data_lock.h:118
size_t m_requesting_engine_lock_id_length
Definition: pfs_data_lock.h:188
char m_blocking_engine_lock_id[max_len]
Column BLOCKING_ENGINE_LOCK_ID.
Definition: pfs_data_lock.h:190
Definition: pfs_data_lock.h:42
char m_engine_lock_id[max_len]
Column ENGINE_LOCK_ID.
Definition: pfs_data_lock.h:77
void set(const char *str, size_t len)
Definition: pfs_data_lock.h:58
void reset()
Definition: pfs_data_lock.h:48
size_t m_engine_lock_id_length
Definition: pfs_data_lock.h:78
const char * str() const
Definition: pfs_data_lock.h:72
void set(const pk_pos_data_lock *other)
Definition: pfs_data_lock.h:53
pk_pos_data_lock()
Definition: pfs_data_lock.h:46
size_t length() const
Definition: pfs_data_lock.h:73
static constexpr size_t max_len
Definition: pfs_data_lock.h:44
A row of table PERFORMANCE_SCHEMA.DATA_LOCK_WAITS.
Definition: pfs_data_lock.h:198
pk_pos_data_lock_wait m_hidden_pk
Engine (REQUESTING_LOCK_ID, BLOCKING_LOCK_ID) key.
Definition: pfs_data_lock.h:202
const void * m_requesting_identity
Column REQUESTING_OBJECT_INSTANCE_BEGIN.
Definition: pfs_data_lock.h:210
ulonglong m_blocking_thread_id
Column BLOCKING_THREAD_ID.
Definition: pfs_data_lock.h:214
ulonglong m_requesting_event_id
Column REQUESTING_EVENT_ID.
Definition: pfs_data_lock.h:208
ulonglong m_blocking_event_id
Column BLOCKING_EVENT_ID.
Definition: pfs_data_lock.h:216
ulonglong m_requesting_thread_id
Column REQUESTING_THREAD_ID.
Definition: pfs_data_lock.h:206
const void * m_blocking_identity
Column BLOCKING_OBJECT_INSTANCE_BEGIN.
Definition: pfs_data_lock.h:218
ulonglong m_requesting_transaction_id
Column REQUESTING_ENGINE_TRANSACTION_ID.
Definition: pfs_data_lock.h:204
const char * m_engine
Column ENGINE.
Definition: pfs_data_lock.h:200
ulonglong m_blocking_transaction_id
Column BLOCKING_ENGINE_TRANSACTION_ID.
Definition: pfs_data_lock.h:212
A row of table PERFORMANCE_SCHEMA.DATA_LOCKS.
Definition: pfs_data_lock.h:85
const char * m_lock_status
Column LOCK_STATUS.
Definition: pfs_data_lock.h:111
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: pfs_data_lock.h:105
ulonglong m_transaction_id
Column ENGINE_TRANSACTION_ID.
Definition: pfs_data_lock.h:91
size_t m_sub_partition_name_length
Definition: pfs_data_lock.h:103
ulonglong m_thread_id
Column THREAD_ID.
Definition: pfs_data_lock.h:93
const char * m_lock_data
Column LOCK_DATA.
Definition: pfs_data_lock.h:113
const char * m_lock_mode
Column LOCK_MODE.
Definition: pfs_data_lock.h:107
const char * m_engine
Column ENGINE.
Definition: pfs_data_lock.h:87
const char * m_lock_type
Column LOCK_TYPE.
Definition: pfs_data_lock.h:109
PFS_index_view_row m_index_row
Columns OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, INDEX_NAME.
Definition: pfs_data_lock.h:97
ulonglong m_event_id
Column EVENT_ID.
Definition: pfs_data_lock.h:95
pk_pos_data_lock m_hidden_pk
Column ENGINE_LOCK_ID.
Definition: pfs_data_lock.h:89
size_t m_partition_name_length
Definition: pfs_data_lock.h:100
const char * m_partition_name
Column PARTITION_NAME.
Definition: pfs_data_lock.h:99
const char * m_sub_partition_name
Column SUB_PARTITION_NAME.
Definition: pfs_data_lock.h:102
Helpers to implement a performance schema table.