MySQL 8.0.39
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;
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 */
211 /** Column BLOCKING_ENGINE_TRANSACTION_ID */
213 /** Column BLOCKING_THREAD_ID */
215 /** Column BLOCKING_EVENT_ID */
217 /** Column BLOCKING_OBJECT_INSTANCE_BEGIN */
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
272
273 bool match_lock_id(const char *engine_lock_id,
274 size_t engine_lock_id_length) override {
275 if (m_fields >= 1) {
276 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
277 return false;
278 }
279 }
280
281 return true;
282 }
283
284 bool match_engine(const char *engine, size_t engine_length) override {
285 if (m_fields >= 2) {
286 if (!m_key_2.match(engine, engine_length)) {
287 return false;
288 }
289 }
290
291 return true;
292 }
293
294 private:
297};
298
300 public:
303 m_key_1("ENGINE_TRANSACTION_ID"),
304 m_key_2("ENGINE") {}
305
307
308 bool match_transaction_id(ulonglong engine_transaction_id) override {
309 if (m_fields >= 1) {
310 if (!m_key_1.match(engine_transaction_id)) {
311 return false;
312 }
313 }
314
315 return true;
316 }
317
318 bool match_engine(const char *engine, size_t engine_length) override {
319 if (m_fields >= 2) {
320 if (!m_key_2.match(engine, engine_length)) {
321 return false;
322 }
323 }
324
325 return true;
326 }
327
328 private:
331};
332
334 public:
337 m_key_1("THREAD_ID"),
338 m_key_2("EVENT_ID") {}
339
341
343 ulonglong event_id) override {
344 if (m_fields >= 1) {
345 if (!m_key_1.match(thread_id)) {
346 return false;
347 }
348 }
349
350 if (m_fields >= 2) {
351 if (!m_key_2.match(event_id)) {
352 return false;
353 }
354 }
355
356 return true;
357 }
358
359 private:
362};
363
365 public:
368 m_key_1("OBJECT_SCHEMA"),
369 m_key_2("OBJECT_NAME"),
370 m_key_3("PARTITION_NAME"),
371 m_key_4("SUBPARTITION_NAME") {}
372
374
375 bool match_object(const char *table_schema, size_t table_schema_length,
376 const char *table_name, size_t table_name_length,
377 const char *partition_name, size_t partition_name_length,
378 const char *sub_partition_name,
379 size_t sub_partition_name_length) override {
380 if (m_fields >= 1) {
381 if (!m_key_1.match(table_schema, table_schema_length)) {
382 return false;
383 }
384 }
385
386 if (m_fields >= 2) {
387 if (!m_key_2.match(table_name, table_name_length)) {
388 return false;
389 }
390 }
391
392 if (m_fields >= 3) {
393 if (!m_key_3.match(partition_name, partition_name_length)) {
394 return false;
395 }
396 }
397
398 if (m_fields >= 4) {
399 if (!m_key_4.match(sub_partition_name, sub_partition_name_length)) {
400 return false;
401 }
402 }
403
404 return true;
405 }
406
407 private:
412};
413
415 public:
417 : PFS_engine_index(key_1, key_2) {}
418
419 ~PFS_index_data_lock_waits() override = default;
420
421 virtual bool match_engine(const char *engine [[maybe_unused]],
422 size_t engine_length [[maybe_unused]]) {
423 return true;
424 }
425
426 virtual bool match_requesting_lock_id(const char *engine_lock_id
427 [[maybe_unused]],
428 size_t engine_lock_id_length
429 [[maybe_unused]]) {
430 return true;
431 }
432
433 virtual bool match_blocking_lock_id(const char *engine_lock_id
434 [[maybe_unused]],
435 size_t engine_lock_id_length
436 [[maybe_unused]]) {
437 return true;
438 }
439
440 virtual bool match_requesting_transaction_id(ulonglong engine_transaction_id
441 [[maybe_unused]]) {
442 return true;
443 }
444
445 virtual bool match_blocking_transaction_id(ulonglong engine_transaction_id
446 [[maybe_unused]]) {
447 return true;
448 }
449
451 [[maybe_unused]],
452 ulonglong event_id
453 [[maybe_unused]]) {
454 return true;
455 }
456
458 [[maybe_unused]],
459 ulonglong event_id
460 [[maybe_unused]]) {
461 return true;
462 }
463};
464
467 public:
470 m_key_1("REQUESTING_ENGINE_LOCK_ID"),
471 m_key_2("ENGINE") {}
472
474
475 bool match_requesting_lock_id(const char *engine_lock_id,
476 size_t engine_lock_id_length) override {
477 if (m_fields >= 1) {
478 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
479 return false;
480 }
481 }
482
483 return true;
484 }
485
486 bool match_engine(const char *engine, size_t engine_length) override {
487 if (m_fields >= 2) {
488 if (!m_key_2.match(engine, engine_length)) {
489 return false;
490 }
491 }
492
493 return true;
494 }
495
496 private:
499};
500
503 public:
506 m_key_1("BLOCKING_ENGINE_LOCK_ID"),
507 m_key_2("ENGINE") {}
508
510
511 bool match_blocking_lock_id(const char *engine_lock_id,
512 size_t engine_lock_id_length) override {
513 if (m_fields >= 1) {
514 if (!m_key_1.match(engine_lock_id, engine_lock_id_length)) {
515 return false;
516 }
517 }
518
519 return true;
520 }
521
522 bool match_engine(const char *engine, size_t engine_length) override {
523 if (m_fields >= 2) {
524 if (!m_key_2.match(engine, engine_length)) {
525 return false;
526 }
527 }
528
529 return true;
530 }
531
532 private:
535};
536
539 public:
542 m_key_1("REQUESTING_ENGINE_TRANSACTION_ID"),
543 m_key_2("ENGINE") {}
544
546
548 ulonglong engine_transaction_id) override {
549 if (m_fields >= 1) {
550 if (!m_key_1.match(engine_transaction_id)) {
551 return false;
552 }
553 }
554
555 return true;
556 }
557
558 bool match_engine(const char *engine, size_t engine_length) override {
559 if (m_fields >= 2) {
560 if (!m_key_2.match(engine, engine_length)) {
561 return false;
562 }
563 }
564
565 return true;
566 }
567
568 private:
571};
572
575 public:
578 m_key_1("BLOCKING_ENGINE_TRANSACTION_ID"),
579 m_key_2("ENGINE") {}
580
582
583 bool match_blocking_transaction_id(ulonglong engine_transaction_id) override {
584 if (m_fields >= 1) {
585 if (!m_key_1.match(engine_transaction_id)) {
586 return false;
587 }
588 }
589
590 return true;
591 }
592
593 bool match_engine(const char *engine, size_t engine_length) override {
594 if (m_fields >= 2) {
595 if (!m_key_2.match(engine, engine_length)) {
596 return false;
597 }
598 }
599
600 return true;
601 }
602
603 private:
606};
607
610 public:
613 m_key_1("REQUESTING_THREAD_ID"),
614 m_key_2("REQUESTING_EVENT_ID") {}
615
617
619 ulonglong event_id) override {
620 if (m_fields >= 1) {
621 if (!m_key_1.match(thread_id)) {
622 return false;
623 }
624 }
625
626 if (m_fields >= 2) {
627 if (!m_key_2.match(event_id)) {
628 return false;
629 }
630 }
631
632 return true;
633 }
634
635 private:
638};
639
642 public:
645 m_key_1("BLOCKING_THREAD_ID"),
646 m_key_2("BLOCKING_EVENT_ID") {}
647
649
651 ulonglong event_id) override {
652 if (m_fields >= 1) {
653 if (!m_key_1.match(thread_id)) {
654 return false;
655 }
656 }
657
658 if (m_fields >= 2) {
659 if (!m_key_2.match(event_id)) {
660 return false;
661 }
662 }
663
664 return true;
665 }
666
667 private:
670};
671
672template <class T>
674 public:
677
679 : PFS_std_allocator<T>(other) {}
680
681 template <class U>
683 const PFS_data_container_allocator<U> &u) noexcept
685};
686
688 private:
689 typedef std::unordered_set<std::string, std::hash<std::string>,
690 std::equal_to<std::string>,
693
695
696 public:
699
700 const char *cache_data(const char *ptr, size_t length) {
701 /*
702 std::string is just a sequence of bytes,
703 which actually can contain a 0 byte ...
704 Never use strlen() on the binary data.
705 */
706 const std::string key(ptr, length);
707 std::pair<set_type::iterator, bool> ret;
708
709 ret = m_set.insert(key);
710 return (*ret.first).data();
711 }
712
713 void clear() { m_set.clear(); }
714};
715
717 public:
720
721 const char *cache_string(const char *string) override;
722 const char *cache_data(const char *ptr, size_t length) override;
723 void cache_identifier(PSI_identifier kind, const char *str, size_t length,
724 const char **cached_ptr,
725 size_t *cached_length) override;
726
727 bool accept_engine(const char *engine, size_t engine_length) override;
728 bool accept_lock_id(const char *engine_lock_id,
729 size_t engine_lock_id_length) override;
730 bool accept_transaction_id(ulonglong transaction_id) override;
732 ulonglong event_id) override;
733 bool accept_object(const char *table_schema, size_t table_schema_length,
734 const char *table_name, size_t table_name_length,
735 const char *partition_name, size_t partition_name_length,
736 const char *sub_partition_name,
737 size_t sub_partition_name_length) override;
738
739 void add_lock_row(const char *engine, size_t engine_length,
740 const char *engine_lock_id, size_t engine_lock_id_length,
741 ulonglong transaction_id, ulonglong thread_id,
742 ulonglong event_id, const char *table_schema,
743 size_t table_schema_length, const char *table_name,
744 size_t table_name_length, const char *partition_name,
745 size_t partition_name_length,
746 const char *sub_partition_name,
747 size_t sub_partition_name_length, const char *index_name,
748 size_t index_name_length, const void *identity,
749 const char *lock_mode, const char *lock_type,
750 const char *lock_status, const char *lock_data) override;
751
752 /**
753 Clear the container.
754 New rows added will start at index 0.
755 */
756 void clear();
757 /**
758 Shrink the container.
759 New rows added will continue to use the current index.
760 */
761 void shrink();
762 row_data_lock *get_row(size_t index);
763
764 void set_filter(PFS_index_data_locks *filter) { m_filter = filter; }
765
766 private:
768 std::vector<row_data_lock, PFS_data_container_allocator<row_data_lock>>
772};
773
776 public:
779
780 const char *cache_string(const char *string) override;
781 const char *cache_data(const char *ptr, size_t length) override;
782
783 bool accept_engine(const char *engine, size_t engine_length) override;
784 bool accept_requesting_lock_id(const char *engine_lock_id,
785 size_t engine_lock_id_length) override;
786 bool accept_blocking_lock_id(const char *engine_lock_id,
787 size_t engine_lock_id_length) override;
788 bool accept_requesting_transaction_id(ulonglong transaction_id) override;
789 bool accept_blocking_transaction_id(ulonglong transaction_id) override;
791 ulonglong event_id) override;
793 ulonglong event_id) override;
794
796 const char *engine, size_t engine_length,
797 const char *requesting_engine_lock_id,
798 size_t requesting_engine_lock_id_length,
799 ulonglong requesting_transaction_id, ulonglong requesting_thread_id,
800 ulonglong requesting_event_id, const void *requesting_identity,
801 const char *blocking_engine_lock_id,
802 size_t blocking_engine_lock_id_length, ulonglong blocking_transaction_id,
803 ulonglong blocking_thread_id, ulonglong blocking_event_id,
804 const void *blocking_identity) override;
805
806 /**
807 Clear the container.
808 New rows added will start at index 0.
809 */
810 void clear();
811 /**
812 Shrink the container.
813 New rows added will continue to use the current index.
814 */
815 void shrink();
816 row_data_lock_wait *get_row(size_t index);
817
819
820 private:
827};
828
829#endif
Definition: pfs_data_lock.h:687
void clear()
Definition: pfs_data_lock.h:713
const char * cache_data(const char *ptr, size_t length)
Definition: pfs_data_lock.h:700
set_type m_set
Definition: pfs_data_lock.h:694
PFS_data_cache()
Definition: pfs_data_lock.h:697
~PFS_data_cache()
Definition: pfs_data_lock.h:698
std::unordered_set< std::string, std::hash< std::string >, std::equal_to< std::string >, PFS_data_container_allocator< std::string > > set_type
Definition: pfs_data_lock.h:692
Definition: pfs_data_lock.h:673
constexpr PFS_data_container_allocator(const PFS_data_container_allocator< U > &u) noexcept
Definition: pfs_data_lock.h:682
PFS_data_container_allocator(const PFS_data_container_allocator &other)
Definition: pfs_data_lock.h:678
PFS_data_container_allocator()
Definition: pfs_data_lock.h:675
Definition: pfs_data_lock.h:716
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:769
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:767
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:764
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:771
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:770
void shrink()
Shrink the container.
Definition: pfs_data_lock.cc:342
Definition: pfs_data_lock.h:775
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:825
void set_filter(PFS_index_data_lock_waits *filter)
Definition: pfs_data_lock.h:818
~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:824
PFS_index_data_lock_waits * m_filter
Definition: pfs_data_lock.h:826
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:821
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:300
Definition: pfs_engine_table.h:268
Definition: pfs_data_lock.h:502
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:522
bool match_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:511
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:534
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:533
~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:504
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:669
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:668
PFS_index_data_lock_waits_by_blocking_thread_id()
Definition: pfs_data_lock.h:643
~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:650
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:605
PFS_index_data_lock_waits_by_blocking_transaction_id()
Definition: pfs_data_lock.h:576
bool match_blocking_transaction_id(ulonglong engine_transaction_id) override
Definition: pfs_data_lock.h:583
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:593
~PFS_index_data_lock_waits_by_blocking_transaction_id() override=default
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:604
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:498
PFS_index_data_lock_waits_by_requesting_lock_id()
Definition: pfs_data_lock.h:468
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:497
~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:475
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:486
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:636
~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:618
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:637
PFS_index_data_lock_waits_by_requesting_thread_id()
Definition: pfs_data_lock.h:611
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:569
~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:547
PFS_index_data_lock_waits_by_requesting_transaction_id()
Definition: pfs_data_lock.h:540
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:570
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:558
Definition: pfs_data_lock.h:414
virtual bool match_blocking_lock_id(const char *engine_lock_id, size_t engine_lock_id_length)
Definition: pfs_data_lock.h:433
virtual bool match_requesting_thread_id_event_id(ulonglong thread_id, ulonglong event_id)
Definition: pfs_data_lock.h:450
~PFS_index_data_lock_waits() override=default
virtual bool match_blocking_transaction_id(ulonglong engine_transaction_id)
Definition: pfs_data_lock.h:445
PFS_index_data_lock_waits(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: pfs_data_lock.h:416
virtual bool match_engine(const char *engine, size_t engine_length)
Definition: pfs_data_lock.h:421
virtual bool match_requesting_transaction_id(ulonglong engine_transaction_id)
Definition: pfs_data_lock.h:440
virtual bool match_blocking_thread_id_event_id(ulonglong thread_id, ulonglong event_id)
Definition: pfs_data_lock.h:457
virtual bool match_requesting_lock_id(const char *engine_lock_id, size_t engine_lock_id_length)
Definition: pfs_data_lock.h:426
Definition: pfs_data_lock.h:264
~PFS_index_data_locks_by_lock_id() override=default
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:296
PFS_key_engine_lock_id m_key_1
Definition: pfs_data_lock.h:295
bool match_lock_id(const char *engine_lock_id, size_t engine_lock_id_length) override
Definition: pfs_data_lock.h:273
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:284
PFS_index_data_locks_by_lock_id()
Definition: pfs_data_lock.h:266
Definition: pfs_data_lock.h:364
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:375
~PFS_index_data_locks_by_object() override=default
PFS_index_data_locks_by_object()
Definition: pfs_data_lock.h:366
PFS_key_object_name m_key_2
Definition: pfs_data_lock.h:409
PFS_key_object_schema m_key_1
Definition: pfs_data_lock.h:408
PFS_key_name m_key_4
Definition: pfs_data_lock.h:411
PFS_key_name m_key_3
Definition: pfs_data_lock.h:410
Definition: pfs_data_lock.h:333
PFS_index_data_locks_by_thread_id()
Definition: pfs_data_lock.h:335
PFS_key_thread_id m_key_1
Definition: pfs_data_lock.h:360
PFS_key_event_id m_key_2
Definition: pfs_data_lock.h:361
~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:342
Definition: pfs_data_lock.h:299
bool match_engine(const char *engine, size_t engine_length) override
Definition: pfs_data_lock.h:318
PFS_index_data_locks_by_transaction_id()
Definition: pfs_data_lock.h:301
bool match_transaction_id(ulonglong engine_transaction_id) override
Definition: pfs_data_lock.h:308
PFS_key_engine_name m_key_2
Definition: pfs_data_lock.h:330
~PFS_index_data_locks_by_transaction_id() override=default
PFS_key_engine_transaction_id m_key_1
Definition: pfs_data_lock.h:329
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:1580
bool match(const char *engine_lock_id, size_t length)
Definition: table_helper.cc:2205
Definition: table_helper.h:1570
bool match(const char *engine_name, size_t length)
Definition: table_helper.cc:2201
Definition: table_helper.h:1317
bool match(ulonglong engine_transaction_id)
Definition: table_helper.cc:1891
Definition: table_helper.h:1294
bool match(ulonglong event_id)
Definition: table_helper.cc:1856
Definition: table_helper.h:1535
bool match(const LEX_CSTRING *name)
Definition: table_helper.cc:2155
Definition: table_helper.h:1637
bool match(const PFS_table_share *share)
Definition: table_helper.cc:2412
Definition: table_helper.h:1622
bool match(const PFS_table_share *share)
Definition: table_helper.cc:2374
Definition: table_helper.h:1278
bool match(ulonglong thread_id)
Definition: table_helper.cc:1795
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:52
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:1052
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:2874
PFS_builtin_memory_class builtin_memory_data_container
Definition: pfs_builtin_memory.cc:125
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:678
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.