MySQL 8.0.31
Source Code Documentation
sync0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2022, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/sync0types.h
28 Global types for sync
29
30 Created 9/5/1995 Heikki Tuuri
31 *******************************************************/
32
33#ifndef sync0types_h
34#define sync0types_h
35
36#include <iostream>
37#include <vector>
38
39#include "sync0sync.h"
40#include "univ.i"
41#include "ut0counter.h"
42#include "ut0log.h"
43#include "ut0new.h"
44
45#ifdef UNIV_DEBUG
46/** Set when InnoDB has invoked exit(). */
47extern bool innodb_calling_exit;
48#endif /* UNIV_DEBUG */
49
50#ifdef _WIN32
51/** Native mutex */
52typedef CRITICAL_SECTION sys_mutex_t;
53#else
54/** Native mutex */
55typedef pthread_mutex_t sys_mutex_t;
56#endif /* _WIN32 */
57
58/*
59 LATCHING ORDER WITHIN THE DATABASE
60 ==================================
61
62The mutex or latch in the central memory object, for instance, a rollback
63segment object, must be acquired before acquiring the latch or latches to
64the corresponding file data structure. In the latching order below, these
65file page object latches are placed immediately below the corresponding
66central memory object latch or mutex.
67
68Synchronization object Notes
69---------------------- -----
70
71Dictionary mutex If we have a pointer to a dictionary
72| object, e.g., a table, it can be
73| accessed without reserving the
74| dictionary mutex. We must have a
75| reservation, a memoryfix, to the
76| appropriate table object in this case,
77| and the table must be explicitly
78| released later.
79V
80Dictionary header
81|
82V
83Secondary index tree latch The tree latch protects also all
84| the B-tree non-leaf pages. These
85V can be read with the page only
86Secondary index non-leaf bufferfixed to save CPU time,
87| no s-latch is needed on the page.
88| Modification of a page requires an
89| x-latch on the page, however. If a
90| thread owns an x-latch to the tree,
91| it is allowed to latch non-leaf pages
92| even after it has acquired the fsp
93| latch.
94V
95Secondary index leaf The latch on the secondary index leaf
96| can be kept while accessing the
97| clustered index, to save CPU time.
98V
99Clustered index tree latch To increase concurrency, the tree
100| latch is usually released when the
101| leaf page latch has been acquired.
102V
103Clustered index non-leaf
104|
105V
106Clustered index leaf
107|
108V
109Transaction system header
110|
111V
112Transaction undo mutex The undo log entry must be written
113| before any index page is modified.
114| Transaction undo mutex is for the undo
115| logs the analogue of the tree latch
116| for a B-tree. If a thread has the
117| trx undo mutex reserved, it is allowed
118| to latch the undo log pages in any
119| order, and also after it has acquired
120| the fsp latch.
121V
122Rollback segment mutex The rollback segment mutex must be
123| reserved, if, e.g., a new page must
124| be added to an undo log. The rollback
125| segment and the undo logs in its
126| history list can be seen as an
127| analogue of a B-tree, and the latches
128| reserved similarly, using a version of
129| lock-coupling. If an undo log must be
130| extended by a page when inserting an
131| undo log record, this corresponds to
132| a pessimistic insert in a B-tree.
133V
134Rollback segment header
135|
136V
137Purge system latch
138|
139V
140Undo log pages If a thread owns the trx undo mutex,
141| or for a log in the history list, the
142| rseg mutex, it is allowed to latch
143| undo log pages in any order, and even
144| after it has acquired the fsp latch.
145| If a thread does not have the
146| appropriate mutex, it is allowed to
147| latch only a single undo log page in
148| a mini-transaction.
149V
150File space management latch If a mini-transaction must allocate
151| several file pages, it can do that,
152| because it keeps the x-latch to the
153| file space management in its memo.
154V
155File system pages
156|
157V
158lock_sys_wait_mutex Mutex protecting lock timeout data
159|
160V
161lock_sys->global_sharded_latch Sharded rw-latch protecting lock_sys_t
162|
163V
164lock_sys->table_mutexes Mutexes protecting lock_sys_t table
165| lock queues
166|
167V
168lock_sys->page_mutexes Mutexes protecting lock_sys_t page
169| lock queues
170|
171V
172trx_sys->mutex Mutex protecting trx_sys_t
173|
174V
175Threads mutex Background thread scheduling mutex
176|
177V
178query_thr_mutex Mutex protecting query threads
179|
180V
181trx_mutex Mutex protecting trx_t fields
182|
183V
184Search system mutex
185|
186V
187Buffer pool mutexes
188|
189V
190Log mutex
191|
192Any other latch
193|
194V
195Memory pool mutex */
196
197/** Latching order levels. If you modify these, you have to also update
198LatchDebug internals in sync0debug.cc */
199
202
204
210
212
214
216
218
220
230
232
234
236
242
256
270
272
278
280
300
303
314
316
318
320
322
323 /** Level is varying. Only used with buffer pool page locks, which
324 do not have a fixed level, but instead have their level set after
325 the page is locked; see e.g. ibuf_bitmap_get_map_page(). */
326
328
329 /** This can be used to suppress order checking. */
331
332 /** Maximum level value */
335
336/** Each latch has an ID. This id is used for creating the latch and to look
337up its meta-data. See sync0debug.c. The order does not matter here, but
338alphabetical ordering seems useful */
463
464/** OS mutex, without any policy. It is a thin wrapper around the
465system mutexes. The interface is different from the policy mutexes,
466to ensure that it is called directly and not confused with the
467policy mutexes. */
468struct OSMutex {
469 /** Constructor */
471
472 /** Create the mutex by calling the system functions. */
474 ut_ad(m_freed);
475
476#ifdef _WIN32
477 InitializeCriticalSection((LPCRITICAL_SECTION)&m_mutex);
478#else
479 {
480 int ret = pthread_mutex_init(&m_mutex, nullptr);
481 ut_a(ret == 0);
482 }
483#endif /* _WIN32 */
484
485 ut_d(m_freed = false);
486 }
487
488 /** Destructor */
489 ~OSMutex() = default;
490
491 /** Destroy the mutex */
494#ifdef _WIN32
495 DeleteCriticalSection((LPCRITICAL_SECTION)&m_mutex);
496#else
497 int ret;
498
499 ret = pthread_mutex_destroy(&m_mutex);
500
501 if (ret != 0) {
502#ifdef UNIV_NO_ERR_MSGS
503 ib::error()
504#else
505 ib::error(ER_IB_MSG_1372)
506#endif
507 << "Return value " << ret << " when calling pthread_mutex_destroy().";
508 }
509#endif /* _WIN32 */
510 ut_d(m_freed = true);
511 }
512
513 /** Release the mutex. */
516#ifdef _WIN32
517 LeaveCriticalSection(&m_mutex);
518#else
519 int ret = pthread_mutex_unlock(&m_mutex);
520 ut_a(ret == 0);
521#endif /* _WIN32 */
522 }
523
524 /** Acquire the mutex. */
527#ifdef _WIN32
528 EnterCriticalSection((LPCRITICAL_SECTION)&m_mutex);
529#else
530 int ret = pthread_mutex_lock(&m_mutex);
531 ut_a(ret == 0);
532#endif /* _WIN32 */
533 }
534
535 void lock() { enter(); }
536 void unlock() { exit(); }
537
538 /** @return true if locking succeeded */
541#ifdef _WIN32
542 return (TryEnterCriticalSection(&m_mutex) != 0);
543#else
544 return (pthread_mutex_trylock(&m_mutex) == 0);
545#endif /* _WIN32 */
546 }
547
548 /** Required for os_event_t */
549 operator sys_mutex_t *() UNIV_NOTHROW { return (&m_mutex); }
550
551#if defined(UNIV_LIBRARY) && defined(UNIV_DEBUG)
552 bool is_owned() {
553 /* This should never be reached. This is
554 added to fix is_owned() compilation errors
555 for library. We will never reach here because
556 mutexes are disabled in library. */
557 ut_error;
558 return (false);
559 }
560#endif /* UNIV_LIBRARY && UNIV_DEBUG */
561
562 private:
563#ifdef UNIV_DEBUG
564 /** true if the mutex has been freed/destroyed. */
566#endif /* UNIV_DEBUG */
567
569};
570
571#ifndef UNIV_LIBRARY
572#ifdef UNIV_PFS_MUTEX
573/** Latch element
574Used for mutexes which have PFS keys defined under UNIV_PFS_MUTEX.
575@param[in] id Latch id
576@param[in] level Latch level
577@param[in] key PFS key */
578#define LATCH_ADD_MUTEX(id, level, key) \
579 latch_meta[LATCH_ID_##id] = ut::new_withkey<latch_meta_t>( \
580 UT_NEW_THIS_FILE_PSI_KEY, LATCH_ID_##id, #id, level, #level, key)
581
582#ifdef UNIV_PFS_RWLOCK
583/** Latch element.
584Used for rwlocks which have PFS keys defined under UNIV_PFS_RWLOCK.
585@param[in] id Latch id
586@param[in] level Latch level
587@param[in] key PFS key */
588#define LATCH_ADD_RWLOCK(id, level, key) \
589 latch_meta[LATCH_ID_##id] = ut::new_withkey<latch_meta_t>( \
590 UT_NEW_THIS_FILE_PSI_KEY, LATCH_ID_##id, #id, level, #level, key)
591#else
592#define LATCH_ADD_RWLOCK(id, level, key) \
593 latch_meta[LATCH_ID_##id] = \
594 ut::new_withkey<latch_meta_t>(UT_NEW_THIS_FILE_PSI_KEY, LATCH_ID_##id, \
595 #id, level, #level, PSI_NOT_INSTRUMENTED)
596#endif /* UNIV_PFS_RWLOCK */
597
598#else
599#define LATCH_ADD_MUTEX(id, level, key) \
600 latch_meta[LATCH_ID_##id] = ut::new_withkey<latch_meta_t>( \
601 UT_NEW_THIS_FILE_PSI_KEY, LATCH_ID_##id, #id, level, #level)
602#define LATCH_ADD_RWLOCK(id, level, key) \
603 latch_meta[LATCH_ID_##id] = ut::new_withkey<latch_meta_t>( \
604 UT_NEW_THIS_FILE_PSI_KEY, LATCH_ID_##id, #id, level, #level)
605#endif /* UNIV_PFS_MUTEX */
606
607/** Default latch counter */
609 public:
610 /** The counts we collect for a mutex */
611 struct Count {
612 /** Constructor */
614 /* No op */
615 }
616
617 /** Rest the values to zero */
619 m_spins = 0;
620 m_waits = 0;
621 m_calls = 0;
622 }
623
624 /** Number of spins trying to acquire the latch. */
625 uint32_t m_spins;
626
627 /** Number of waits trying to acquire the latch */
628 uint32_t m_waits;
629
630 /** Number of times it was called */
631 uint32_t m_calls;
632
633 /** true if enabled */
635 };
636
637 /** Constructor */
639
640 /** Destructor */
643
644 for (Count *count : m_counters) {
646 }
647 }
648
649 /** Reset all counters to zero. It is not protected by any
650 mutex and we don't care about atomicity. Unless it is a
651 demonstrated problem. The information collected is not
652 required for the correct functioning of the server. */
654 m_mutex.enter();
655
656 for (Count *count : m_counters) {
657 count->reset();
658 }
659
660 m_mutex.exit();
661 }
662
663 /** @return the aggregate counter */
665 m_mutex.enter();
666
667 Count *count;
668
669 if (m_counters.empty()) {
670 count = ut::new_withkey<Count>(UT_NEW_THIS_FILE_PSI_KEY);
671 m_counters.push_back(count);
672 } else {
673 ut_a(m_counters.size() == 1);
674 count = m_counters[0];
675 }
676
677 m_mutex.exit();
678
679 return (count);
680 }
681
682 /** Deregister the count. We don't do anything
683 @param[in] count The count instance to deregister */
685 [[maybe_unused]]) const UNIV_NOTHROW { /* Do nothing */
686 }
687
688 /** Register a single instance counter */
690 m_mutex.enter();
691
692 m_counters.push_back(count);
693
694 m_mutex.exit();
695 }
696
697 /** Deregister a single instance counter
698 @param[in] count The count instance to deregister */
700 m_mutex.enter();
701
702 m_counters.erase(std::remove(m_counters.begin(), m_counters.end(), count),
703 m_counters.end());
704
705 m_mutex.exit();
706 }
707
708 /** Iterate over the counters */
709 template <typename Callback>
710 void iterate(Callback &&callback) const UNIV_NOTHROW {
711 m_mutex.enter();
712 for (const Count *count : m_counters) {
713 std::forward<Callback>(callback)(count);
714 }
715 m_mutex.exit();
716 }
717
718 /** Disable the monitoring */
720 m_mutex.enter();
721
722 for (Count *count : m_counters) {
723 count->m_enabled = true;
724 }
725
726 m_active = true;
727
728 m_mutex.exit();
729 }
730
731 /** Disable the monitoring */
733 m_mutex.enter();
734
735 for (Count *count : m_counters) {
736 count->m_enabled = false;
737 }
738
739 m_active = false;
740
741 m_mutex.exit();
742 }
743
744 /** @return if monitoring is active */
745 bool is_enabled() const UNIV_NOTHROW { return (m_active); }
746
747 private:
748 /* Disable copying */
751
752 private:
753 typedef OSMutex Mutex;
754 typedef std::vector<Count *> Counters;
755
756 /** Mutex protecting m_counters */
757 mutable Mutex m_mutex;
758
759 /** Counters for the latches */
761
762 /** if true then we collect the data */
764};
765
766/** Latch meta data */
767template <typename Counter = LatchCounter>
769 public:
771
772#ifdef UNIV_PFS_MUTEX
774#endif /* UNIV_PFS_MUTEX */
775
776 /** Constructor */
779 m_name(),
782#ifdef UNIV_PFS_MUTEX
783 ,
784 m_pfs_key()
785#endif /* UNIV_PFS_MUTEX */
786 {
787 }
788
789 /** Destructor */
790 ~LatchMeta() = default;
791
792 /** Constructor
793 @param[in] id Latch id
794 @param[in] name Latch name
795 @param[in] level Latch level
796 @param[in] level_name Latch level text representation
797 @param[in] key PFS key */
798 LatchMeta(latch_id_t id, const char *name, latch_level_t level,
799 const char *level_name
800#ifdef UNIV_PFS_MUTEX
801 ,
803#endif /* UNIV_PFS_MUTEX */
804 )
805 : m_id(id),
806 m_name(name),
807 m_level(level),
808 m_level_name(level_name)
809#ifdef UNIV_PFS_MUTEX
810 ,
812#endif /* UNIV_PFS_MUTEX */
813 {
814 /* No op */
815 }
816
817 /* Less than operator.
818 @param[in] rhs Instance to compare against
819 @return true if this.get_id() < rhs.get_id() */
820 bool operator<(const LatchMeta &rhs) const {
821 return (get_id() < rhs.get_id());
822 }
823
824 /** @return the latch id */
825 latch_id_t get_id() const { return (m_id); }
826
827 /** @return the latch name */
828 const char *get_name() const { return (m_name); }
829
830 /** @return the latch level */
831 latch_level_t get_level() const { return (m_level); }
832
833 /** @return the latch level name */
834 const char *get_level_name() const { return (m_level_name); }
835
836#ifdef UNIV_PFS_MUTEX
837 /** @return the PFS key for the latch */
838 pfs_key_t get_pfs_key() const { return (m_pfs_key); }
839#endif /* UNIV_PFS_MUTEX */
840
841 /** @return the counter instance */
842 Counter *get_counter() { return (&m_counter); }
843
844 private:
845 /** Latch id */
847
848 /** Latch name */
849 const char *m_name;
850
851 /** Latch level in the ordering */
853
854 /** Latch level text representation */
855 const char *m_level_name;
856
857#ifdef UNIV_PFS_MUTEX
858 /** PFS key */
860#endif /* UNIV_PFS_MUTEX */
861
862 /** For gathering latch statistics */
864};
865
867typedef std::vector<latch_meta_t *, ut::allocator<latch_meta_t *>>
869
870/** Note: This is accessed without any mutex protection. It is initialised
871at startup and elements should not be added to or removed from it after
872that. See sync_latch_meta_init() */
874
875/** Get the latch meta-data from the latch ID
876@param[in] id Latch ID
877@return the latch meta data */
879 ut_ad(static_cast<size_t>(id) < latch_meta.size());
880 ut_ad(id == latch_meta[id]->get_id());
881
882 return (*latch_meta[id]);
883}
884
885/** Fetch the counter for the latch
886@param[in] id Latch ID
887@return the latch counter */
890
891 return (meta.get_counter());
892}
893
894/** Get the latch name from the latch ID
895@param[in] id Latch ID
896@return the name, will assert if not found */
897inline const char *sync_latch_get_name(latch_id_t id) {
898 const latch_meta_t &meta = sync_latch_get_meta(id);
899
900 return (meta.get_name());
901}
902
903/** Get the latch ordering level
904@param[in] id Latch id to lookup
905@return the latch level */
907 const latch_meta_t &meta = sync_latch_get_meta(id);
908
909 return (meta.get_level());
910}
911
912#ifdef UNIV_PFS_MUTEX
913/** Get the latch PFS key from the latch ID
914@param[in] id Latch ID
915@return the PFS key */
917 const latch_meta_t &meta = sync_latch_get_meta(id);
918
919 return (meta.get_pfs_key());
920}
921#endif /* UNIV_PFS_MUTEX */
922
923#ifndef UNIV_HOTBACKUP
924/** String representation of the filename and line number where the
925latch was created
926@param[in] id Latch ID
927@param[in] created Filename and line number where it was created
928@return the string representation */
929std::string sync_mutex_to_string(latch_id_t id, const std::string &created);
930
931/** Get the latch name from a sync level
932@param[in] level Latch level to lookup
933@return nullptr if not found. */
934const char *sync_latch_get_name(latch_level_t level);
935
936/** Print the filename "basename"
937@return the basename */
938const char *sync_basename(const char *filename);
939#endif /* !UNIV_HOTBACKUP */
940
941/** Register a latch, called when it is created
942@param[in] ptr Latch instance that was created
943@param[in] filename Filename where it was created
944@param[in] line Line number in filename */
945void sync_file_created_register(const void *ptr, const char *filename,
946 uint16_t line);
947
948/** Deregister a latch, called when it is destroyed
949@param[in] ptr Latch to be destroyed */
950void sync_file_created_deregister(const void *ptr);
951
952/** Get the string where the file was created. Its format is "name:line"
953@param[in] ptr Latch instance
954@return created information or "" if can't be found */
955std::string sync_file_created_get(const void *ptr);
956
957#endif /* !UNIV_LIBRARY */
958
959#ifdef UNIV_DEBUG
960
961/** All (ordered) latches, used in debugging, must derive from this class. */
962struct latch_t {
963 /** Constructor
964 @param[in] id The latch ID */
966 m_rw_lock(),
967 m_temp_fsp() {}
968
969 latch_t &operator=(const latch_t &) = default;
970
971 /** Destructor */
972 virtual ~latch_t() UNIV_NOTHROW = default;
973
974 /** @return the latch ID */
975 latch_id_t get_id() const { return (m_id); }
976
977 /** @return true if it is a rw-lock */
978 bool is_rw_lock() const UNIV_NOTHROW { return (m_rw_lock); }
979
980 /** Print the latch context
981 @return the string representation */
982 virtual std::string to_string() const = 0;
983
984 /** @return "filename:line" from where the latch was last locked */
985 virtual std::string locked_from() const = 0;
986
987 /** @return the latch level */
990
991#ifndef UNIV_LIBRARY
992 return (sync_latch_get_level(m_id));
993#else
994 /* This should never be reached. This is
995 added to fix compilation errors
996 for library. We will never reach here because
997 mutexes are disabled in library. */
998 ut_error;
999 return (SYNC_UNKNOWN);
1000#endif /* !UNIV_LIBRARY */
1001 }
1002
1003 /** @return true if the latch is for a temporary file space*/
1004 bool is_temp_fsp() const UNIV_NOTHROW { return (m_temp_fsp); }
1005
1006 /** Set the temporary tablespace flag. The latch order constraints
1007 are different for intrinsic tables. We don't always acquire the
1008 index->lock. We need to figure out the context and add some special
1009 rules during the checks. */
1012 m_temp_fsp = true;
1013 }
1014
1015 /** @return the latch name, m_id must be set */
1016 const char *get_name() const UNIV_NOTHROW {
1018
1019#ifndef UNIV_LIBRARY
1020 return (sync_latch_get_name(m_id));
1021#else
1022 /* This should never be reached. This is
1023 added to fix compilation errors
1024 for library. We will never reach here because
1025 mutexes are disabled in library. */
1026 ut_error;
1027 return (nullptr);
1028#endif /* !UNIV_LIBRARY */
1029 }
1030
1031 /** Latch ID */
1033
1034 /** true if it is a rw-lock. In debug mode, rw_lock_t derives from
1035 this class and sets this variable. */
1037
1038 /** true if it is an temporary space latch */
1040};
1041
1042/** Subclass this to iterate over a thread's acquired latch levels. */
1044 virtual ~sync_check_functor_t() = default;
1045 virtual bool operator()(const latch_level_t) = 0;
1046 virtual bool result() const = 0;
1047};
1048
1049/** Functor to check whether the calling thread owns the btr search mutex. */
1051 /** Constructor
1052 @param[in] has_search_latch true if owns the latch */
1053 explicit btrsea_sync_check(bool has_search_latch)
1054 : m_result(), m_has_search_latch(has_search_latch) {}
1055
1056 /** Destructor */
1057 ~btrsea_sync_check() override = default;
1058
1059 /** Called for every latch owned by the calling thread.
1060 @param[in] level Level of the existing latch
1061 @return true if the predicate check fails */
1062 bool operator()(const latch_level_t level) override {
1063 /* If calling thread doesn't hold search latch then
1064 check if there are latch level exception provided.
1065
1066 Note: Optimizer has added InnoDB intrinsic table as an
1067 alternative to MyISAM intrinsic table. With this a new
1068 control flow comes into existence, it is:
1069
1070 Server -> Plugin -> SE
1071
1072 Plugin in this case is I_S which is sharing the latch vector
1073 of InnoDB and so there could be lock conflicts. Ideally
1074 the Plugin should use a difference namespace latch vector
1075 as it doesn't have any dependency with SE latching protocol.
1076
1077 Added check that will allow thread to hold I_S latches */
1078
1079 if (!m_has_search_latch &&
1080 (level != SYNC_SEARCH_SYS && level != SYNC_DICT &&
1081 level != SYNC_FTS_CACHE && level != SYNC_UNDO_DDL &&
1082 level != SYNC_DICT_OPERATION && level != SYNC_TRX_I_S_LAST_READ &&
1083 level != SYNC_TRX_I_S_RWLOCK)) {
1084 m_result = true;
1085#ifdef UNIV_NO_ERR_MSGS
1086 ib::error()
1087#else
1088 ib::error(ER_IB_MSG_1373)
1089#endif
1090 << "Debug: Calling thread does not hold search "
1091 "latch but does hold latch level "
1092 << level << ".";
1093
1094 return (m_result);
1095 }
1096
1097 return (false);
1098 }
1099
1100 /** @return result from the check */
1101 bool result() const override { return (m_result); }
1102
1103 private:
1104 /** True if all OK */
1106
1107 /** If the caller owns the search latch */
1109};
1110
1111/** Functor to check for dictionary latching constraints. */
1113 /** Constructor
1114 @param[in] dict_mutex_allowed true if the dict mutex
1115 is allowed */
1116 explicit dict_sync_check(bool dict_mutex_allowed)
1117 : m_result(), m_dict_mutex_allowed(dict_mutex_allowed) {}
1118
1119 /** Destructor */
1120 ~dict_sync_check() override = default;
1121
1122 /** Check the latching constraints
1123 @param[in] level The level held by the thread */
1124 bool operator()(const latch_level_t level) override {
1125 if (!m_dict_mutex_allowed ||
1126 (level != SYNC_DICT && level != SYNC_UNDO_SPACES &&
1127 level != SYNC_FTS_CACHE && level != SYNC_DICT_OPERATION &&
1128 /* This only happens in recv_apply_hashed_log_recs. */
1129 level != SYNC_RECV_WRITER && level != SYNC_NO_ORDER_CHECK)) {
1130 m_result = true;
1131#ifdef UNIV_NO_ERR_MSGS
1132 ib::error()
1133#else
1134 ib::error(ER_IB_MSG_1374)
1135#endif
1136 << "Debug: Dictionary latch order violation for level " << level
1137 << ".";
1138
1139 return (true);
1140 }
1141
1142 return (false);
1143 }
1144
1145 /** @return the result of the check */
1146 virtual bool result() const override { return (m_result); }
1147
1148 private:
1149 /** True if all OK */
1151
1152 /** True if it is OK to hold the dict mutex */
1154};
1155
1156/** Functor to check for given latching constraints. */
1158 /** Constructor
1159 @param[in] from first element in an array of latch_level_t
1160 @param[in] to last element in an array of latch_level_t */
1162 : m_result(), m_latches(from, to) {}
1163
1164 /** Default constructor. The list of allowed latches is empty. */
1166
1167 /** Check whether the given latch_t violates the latch constraint.
1168 This object maintains a list of allowed latch levels, and if the given
1169 latch belongs to a latch level that is not there in the allowed list,
1170 then it is a violation.
1171
1172 @param[in] level The latch level to check
1173 @return true if there is a latch ordering violation */
1174 virtual bool operator()(const latch_level_t level) override {
1175 for (latch_level_t allowed_level : m_latches) {
1176 if (level == allowed_level) {
1177 m_result = false;
1178
1179 /* No violation */
1180 return (m_result);
1181 }
1182 }
1183
1184#ifdef UNIV_NO_ERR_MSGS
1185 ib::error()
1186#else
1187 ib::error(ER_IB_MSG_1375)
1188#endif
1189 << "Debug: sync_allowed_latches violation for level=" << level;
1190 m_result = true;
1191 return (m_result);
1192 }
1193
1194 /** @return the result of the check */
1195 virtual bool result() const override { return (m_result); }
1196
1197 private:
1198 /** Save the result of validation check here
1199 True if all OK */
1201
1202 typedef std::vector<latch_level_t, ut::allocator<latch_level_t>> latches_t;
1203
1204 /** List of latch levels that are allowed to be held */
1206};
1207
1208/** Get the latch id from a latch name.
1209@param[in] name Latch name
1210@return latch id if found else LATCH_ID_NONE. */
1211latch_id_t sync_latch_get_id(const char *name);
1212
1214
1215/* Flags to specify lock types for rw_lock_own_flagged() */
1219 RW_LOCK_FLAG_SX = 1 << 2
1221
1222#endif /* UNIV_DBEUG */
1223
1224#endif /* sync0types_h */
Class that stores callback function reference as well as the result of the callback function call (in...
Definition: keyring_service.cc:42
Default latch counter.
Definition: sync0types.h:608
LatchCounter(const LatchCounter &)
bool is_enabled() const 1
Definition: sync0types.h:745
void single_deregister(Count *count) 1
Deregister a single instance counter.
Definition: sync0types.h:699
Counters m_counters
Counters for the latches.
Definition: sync0types.h:760
LatchCounter() 1
Constructor.
Definition: sync0types.h:638
void sum_deregister(Count *count) const 1
Deregister the count.
Definition: sync0types.h:684
void iterate(Callback &&callback) const 1
Iterate over the counters.
Definition: sync0types.h:710
Mutex m_mutex
Mutex protecting m_counters.
Definition: sync0types.h:757
void disable() 1
Disable the monitoring.
Definition: sync0types.h:732
LatchCounter & operator=(const LatchCounter &)
OSMutex Mutex
Definition: sync0types.h:753
~LatchCounter() 1
Destructor.
Definition: sync0types.h:641
bool m_active
if true then we collect the data
Definition: sync0types.h:763
void single_register(Count *count) 1
Register a single instance counter.
Definition: sync0types.h:689
std::vector< Count * > Counters
Definition: sync0types.h:754
void enable() 1
Disable the monitoring.
Definition: sync0types.h:719
void reset() 1
Reset all counters to zero.
Definition: sync0types.h:653
Count * sum_register() 1
Definition: sync0types.h:664
Latch meta data.
Definition: sync0types.h:768
const char * get_level_name() const
Definition: sync0types.h:834
bool operator<(const LatchMeta &rhs) const
Definition: sync0types.h:820
mysql_pfs_key_t pfs_key_t
Definition: sync0types.h:773
Counter * get_counter()
Definition: sync0types.h:842
Counter CounterType
Definition: sync0types.h:770
pfs_key_t get_pfs_key() const
Definition: sync0types.h:838
latch_level_t m_level
Latch level in the ordering.
Definition: sync0types.h:852
pfs_key_t m_pfs_key
PFS key.
Definition: sync0types.h:859
latch_level_t get_level() const
Definition: sync0types.h:831
Counter m_counter
For gathering latch statistics.
Definition: sync0types.h:863
latch_id_t m_id
Latch id.
Definition: sync0types.h:846
~LatchMeta()=default
Destructor.
const char * get_name() const
Definition: sync0types.h:828
latch_id_t get_id() const
Definition: sync0types.h:825
LatchMeta(latch_id_t id, const char *name, latch_level_t level, const char *level_name, pfs_key_t key)
Constructor.
Definition: sync0types.h:798
LatchMeta()
Constructor.
Definition: sync0types.h:777
const char * m_level_name
Latch level text representation.
Definition: sync0types.h:855
const char * m_name
Latch name.
Definition: sync0types.h:849
The class error is used to emit error messages.
Definition: ut0log.h:229
static int count
Definition: myisam_ftdump.cc:42
Sharded atomic counter.
Definition: ut0counter.h:220
static mysql_service_status_t remove(reference_caching_channel channel, const char *implementation_name) noexcept
Definition: component.cc:144
pid_type get_id()
Definition: process.h:47
void delete_(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::new*() variants.
Definition: ut0new.h:807
const char * filename
Definition: pfs_example_component_population.cc:66
required string key
Definition: replication_asynchronous_connection_failover.proto:59
case opt name
Definition: sslopt-case.h:32
The counts we collect for a mutex.
Definition: sync0types.h:611
uint32_t m_spins
Number of spins trying to acquire the latch.
Definition: sync0types.h:625
void reset() 1
Rest the values to zero.
Definition: sync0types.h:618
uint32_t m_calls
Number of times it was called.
Definition: sync0types.h:631
Count() 1
Constructor.
Definition: sync0types.h:613
uint32_t m_waits
Number of waits trying to acquire the latch.
Definition: sync0types.h:628
bool m_enabled
true if enabled
Definition: sync0types.h:634
OS mutex, without any policy.
Definition: sync0types.h:468
void exit() 1
Release the mutex.
Definition: sync0types.h:514
OSMutex() 1
Constructor.
Definition: sync0types.h:470
bool try_lock() 1
Definition: sync0types.h:539
void enter() 1
Acquire the mutex.
Definition: sync0types.h:525
sys_mutex_t m_mutex
Definition: sync0types.h:568
~OSMutex()=default
Destructor.
void lock()
Definition: sync0types.h:535
bool m_freed
true if the mutex has been freed/destroyed.
Definition: sync0types.h:565
void init() 1
Create the mutex by calling the system functions.
Definition: sync0types.h:473
void unlock()
Definition: sync0types.h:536
void destroy() 1
Destroy the mutex.
Definition: sync0types.h:492
Functor to check whether the calling thread owns the btr search mutex.
Definition: sync0types.h:1050
const bool m_has_search_latch
If the caller owns the search latch.
Definition: sync0types.h:1108
btrsea_sync_check(bool has_search_latch)
Constructor.
Definition: sync0types.h:1053
bool m_result
True if all OK.
Definition: sync0types.h:1105
bool operator()(const latch_level_t level) override
Called for every latch owned by the calling thread.
Definition: sync0types.h:1062
~btrsea_sync_check() override=default
Destructor.
bool result() const override
Definition: sync0types.h:1101
Functor to check for dictionary latching constraints.
Definition: sync0types.h:1112
dict_sync_check(bool dict_mutex_allowed)
Constructor.
Definition: sync0types.h:1116
const bool m_dict_mutex_allowed
True if it is OK to hold the dict mutex.
Definition: sync0types.h:1153
bool m_result
True if all OK.
Definition: sync0types.h:1150
bool operator()(const latch_level_t level) override
Check the latching constraints.
Definition: sync0types.h:1124
~dict_sync_check() override=default
Destructor.
virtual bool result() const override
Definition: sync0types.h:1146
All (ordered) latches, used in debugging, must derive from this class.
Definition: sync0types.h:962
latch_level_t get_level() const 1
Definition: sync0types.h:988
bool is_rw_lock() const 1
Definition: sync0types.h:978
bool m_temp_fsp
true if it is an temporary space latch
Definition: sync0types.h:1039
latch_id_t m_id
Latch ID.
Definition: sync0types.h:1032
virtual ~latch_t() 1=default
Destructor.
void set_temp_fsp() 1
Set the temporary tablespace flag.
Definition: sync0types.h:1010
latch_t & operator=(const latch_t &)=default
bool is_temp_fsp() const 1
Definition: sync0types.h:1004
virtual std::string locked_from() const =0
bool m_rw_lock
true if it is a rw-lock.
Definition: sync0types.h:1036
latch_id_t get_id() const
Definition: sync0types.h:975
virtual std::string to_string() const =0
Print the latch context.
latch_t(latch_id_t id=LATCH_ID_NONE) 1
Constructor.
Definition: sync0types.h:965
const char * get_name() const 1
Definition: sync0types.h:1016
Define for performance schema registration key.
Definition: sync0sync.h:50
Functor to check for given latching constraints.
Definition: sync0types.h:1157
virtual bool result() const override
Definition: sync0types.h:1195
std::vector< latch_level_t, ut::allocator< latch_level_t > > latches_t
Definition: sync0types.h:1202
bool m_result
Save the result of validation check here True if all OK.
Definition: sync0types.h:1200
sync_allowed_latches(const latch_level_t *from, const latch_level_t *to)
Constructor.
Definition: sync0types.h:1161
latches_t m_latches
List of latch levels that are allowed to be held.
Definition: sync0types.h:1205
sync_allowed_latches()
Default constructor.
Definition: sync0types.h:1165
virtual bool operator()(const latch_level_t level) override
Check whether the given latch_t violates the latch constraint.
Definition: sync0types.h:1174
Subclass this to iterate over a thread's acquired latch levels.
Definition: sync0types.h:1043
virtual bool operator()(const latch_level_t)=0
virtual bool result() const =0
virtual ~sync_check_functor_t()=default
Mutex, the basic synchronization primitive.
LatchMetaData latch_meta
Note: This is accessed without any mutex protection.
Definition: sync0debug.cc:1201
pthread_mutex_t sys_mutex_t
Native mutex.
Definition: sync0types.h:55
LatchMeta< LatchCounter > latch_meta_t
Definition: sync0types.h:866
std::string sync_mutex_to_string(latch_id_t id, const std::string &created)
String representation of the filename and line number where the latch was created.
Definition: sync0sync.cc:232
latch_level_t sync_latch_get_level(latch_id_t id)
Get the latch ordering level.
Definition: sync0types.h:906
const char * sync_latch_get_name(latch_id_t id)
Get the latch name from the latch ID.
Definition: sync0types.h:897
std::vector< latch_meta_t *, ut::allocator< latch_meta_t * > > LatchMetaData
Definition: sync0types.h:868
void sync_file_created_register(const void *ptr, const char *filename, uint16_t line)
Register a latch, called when it is created.
Definition: sync0debug.cc:1651
latch_meta_t & sync_latch_get_meta(latch_id_t id)
Get the latch meta-data from the latch ID.
Definition: sync0types.h:878
latch_id_t
Each latch has an ID.
Definition: sync0types.h:339
@ LATCH_ID_LOG_SN_MUTEX
Definition: sync0types.h:374
@ LATCH_ID_LOG_WRITE_NOTIFIER
Definition: sync0types.h:379
@ LATCH_ID_DBLR
Definition: sync0types.h:457
@ LATCH_ID_DICT_TABLE
Definition: sync0types.h:356
@ LATCH_ID_FILE_OPEN
Definition: sync0types.h:452
@ LATCH_ID_SRV_INNODB_MONITOR
Definition: sync0types.h:406
@ LATCH_ID_LOG_CHECKPOINTER
Definition: sync0types.h:375
@ LATCH_ID_RTR_SSN_MUTEX
Definition: sync0types.h:401
@ LATCH_ID_WORK_QUEUE
Definition: sync0types.h:431
@ LATCH_ID_CLONE_TASK
Definition: sync0types.h:454
@ LATCH_ID_TRX_POOL_MANAGER
Definition: sync0types.h:412
@ LATCH_ID_LOG_WRITER
Definition: sync0types.h:377
@ LATCH_ID_BUF_POOL_ZIP
Definition: sync0types.h:344
@ LATCH_ID_LOCK_FREE_HASH
Definition: sync0types.h:368
@ LATCH_ID_FTS_DOC_ID
Definition: sync0types.h:362
@ LATCH_ID_LOG_LIMITS
Definition: sync0types.h:381
@ LATCH_ID_DBLWR_SPACE_CACHE
Definition: sync0types.h:351
@ LATCH_ID_TEST_MUTEX
Definition: sync0types.h:460
@ LATCH_ID_BUF_POOL_ZIP_HASH
Definition: sync0types.h:348
@ LATCH_ID_LOCK_SYS_PAGE
Definition: sync0types.h:370
@ LATCH_ID_LOG_SN
Definition: sync0types.h:373
@ LATCH_ID_TRX
Definition: sync0types.h:414
@ LATCH_ID_FLUSH_LIST
Definition: sync0types.h:358
@ LATCH_ID_EVENT_MANAGER
Definition: sync0types.h:421
@ LATCH_ID_TEMP_SPACE_RSEG
Definition: sync0types.h:397
@ LATCH_ID_UNDO_SPACE_RSEG
Definition: sync0types.h:398
@ LATCH_ID_BUF_CHUNK_MAP_LATCH
Definition: sync0types.h:449
@ LATCH_ID_DICT_PERSIST_CHECKPOINT
Definition: sync0types.h:391
@ LATCH_ID_LOCK_SYS_GLOBAL
Definition: sync0types.h:369
@ LATCH_ID_LOG_ARCH
Definition: sync0types.h:384
@ LATCH_ID_DICT_PERSIST_DIRTY_TABLES
Definition: sync0types.h:389
@ LATCH_ID_OS_AIO_LOG_MUTEX
Definition: sync0types.h:427
@ LATCH_ID_RW_LOCK_LIST
Definition: sync0types.h:405
@ LATCH_ID_IBUF_BITMAP
Definition: sync0types.h:365
@ LATCH_ID_RECV_SYS
Definition: sync0types.h:395
@ LATCH_ID_DICT_TABLE_STATS
Definition: sync0types.h:447
@ LATCH_ID_FTS_CACHE
Definition: sync0types.h:441
@ LATCH_ID_IBUF_INDEX_TREE
Definition: sync0types.h:445
@ LATCH_ID_DICT_FOREIGN_ERR
Definition: sync0types.h:354
@ LATCH_ID_PERSIST_AUTOINC
Definition: sync0types.h:390
@ LATCH_ID_UNDO_SPACES
Definition: sync0types.h:438
@ LATCH_ID_LOG_FILES
Definition: sync0types.h:382
@ LATCH_ID_FTS_OPTIMIZE
Definition: sync0types.h:361
@ LATCH_ID_RTR_ACTIVE_MUTEX
Definition: sync0types.h:402
@ LATCH_ID_PURGE_SYS_PQ
Definition: sync0types.h:393
@ LATCH_ID_MASTER_KEY_ID_MUTEX
Definition: sync0types.h:451
@ LATCH_ID_PAGE_ARCH
Definition: sync0types.h:385
@ LATCH_ID_RW_LOCK_DEBUG
Definition: sync0types.h:400
@ LATCH_ID_IBUF_PESSIMISTIC_INSERT
Definition: sync0types.h:367
@ LATCH_ID_TRX_SYS
Definition: sync0types.h:415
@ LATCH_ID_FIL_SHARD
Definition: sync0types.h:357
@ LATCH_ID_OS_AIO_WRITE_MUTEX
Definition: sync0types.h:426
@ LATCH_ID_TRX_UNDO
Definition: sync0types.h:410
@ LATCH_ID_TRX_I_S_CACHE
Definition: sync0types.h:443
@ LATCH_ID_UNDO_DDL
Definition: sync0types.h:439
@ LATCH_ID_BTR_SEARCH
Definition: sync0types.h:432
@ LATCH_ID_HASH_TABLE_MUTEX
Definition: sync0types.h:364
@ LATCH_ID_PAGE_ARCH_CLIENT
Definition: sync0types.h:387
@ LATCH_ID_ROW_DROP_LIST
Definition: sync0types.h:429
@ LATCH_ID_RECV_WRITER
Definition: sync0types.h:396
@ LATCH_ID_CLONE_SNAPSHOT
Definition: sync0types.h:455
@ LATCH_ID_TRX_PURGE
Definition: sync0types.h:444
@ LATCH_ID_TRX_POOL
Definition: sync0types.h:411
@ LATCH_ID_INDEX_TREE
Definition: sync0types.h:446
@ LATCH_ID_RTR_MATCH_MUTEX
Definition: sync0types.h:403
@ LATCH_ID_BUF_BLOCK_DEBUG
Definition: sync0types.h:434
@ LATCH_ID_MAX
Definition: sync0types.h:461
@ LATCH_ID_SRV_MISC_TMPFILE
Definition: sync0types.h:407
@ LATCH_ID_TRX_SYS_SERIALISATION
Definition: sync0types.h:417
@ LATCH_ID_BUF_POOL_CHUNKS
Definition: sync0types.h:343
@ LATCH_ID_HASH_TABLE_RW_LOCK
Definition: sync0types.h:448
@ LATCH_ID_CACHE_LAST_READ
Definition: sync0types.h:353
@ LATCH_ID_BUF_POOL_ZIP_FREE
Definition: sync0types.h:347
@ LATCH_ID_LOG_FLUSHER
Definition: sync0types.h:378
@ LATCH_ID_CLONE_SYS
Definition: sync0types.h:453
@ LATCH_ID_OS_AIO_IBUF_MUTEX
Definition: sync0types.h:428
@ LATCH_ID_PAGE_ARCH_OPER
Definition: sync0types.h:386
@ LATCH_ID_TRX_SYS_RSEG
Definition: sync0types.h:399
@ LATCH_ID_FTS_BG_THREADS
Definition: sync0types.h:359
@ LATCH_ID_SRV_SYS_TASKS
Definition: sync0types.h:419
@ LATCH_ID_RECALC_POOL
Definition: sync0types.h:394
@ LATCH_ID_LOCK_SYS_WAIT
Definition: sync0types.h:372
@ LATCH_ID_SYNC_DEBUG_MUTEX
Definition: sync0types.h:450
@ LATCH_ID_PARSER
Definition: sync0types.h:383
@ LATCH_ID_DBLWR
Definition: sync0types.h:350
@ LATCH_ID_LOG_CLOSER
Definition: sync0types.h:376
@ LATCH_ID_CHECKPOINT
Definition: sync0types.h:436
@ LATCH_ID_INDEX_ONLINE_LOG
Definition: sync0types.h:430
@ LATCH_ID_BUF_BLOCK_MUTEX
Definition: sync0types.h:342
@ LATCH_ID_FTS_DELETE
Definition: sync0types.h:360
@ LATCH_ID_DICT_OPERATION
Definition: sync0types.h:435
@ LATCH_ID_AUTOINC
Definition: sync0types.h:341
@ LATCH_ID_REDO_LOG_ARCHIVE_QUEUE_MUTEX
Definition: sync0types.h:459
@ LATCH_ID_NONE
Definition: sync0types.h:340
@ LATCH_ID_LOG_FLUSH_NOTIFIER
Definition: sync0types.h:380
@ LATCH_ID_SYNC_THREAD
Definition: sync0types.h:409
@ LATCH_ID_IBUF
Definition: sync0types.h:366
@ LATCH_ID_LOCK_SYS_TABLE
Definition: sync0types.h:371
@ LATCH_ID_FTS_CACHE_INIT
Definition: sync0types.h:442
@ LATCH_ID_OS_AIO_READ_MUTEX
Definition: sync0types.h:425
@ LATCH_ID_BUF_BLOCK_LOCK
Definition: sync0types.h:433
@ LATCH_ID_FTS_PLL_TOKENIZE
Definition: sync0types.h:363
@ LATCH_ID_FIL_SPACE
Definition: sync0types.h:440
@ LATCH_ID_TEMP_POOL_MANAGER
Definition: sync0types.h:413
@ LATCH_ID_BUF_POOL_LRU_LIST
Definition: sync0types.h:345
@ LATCH_ID_DICT_SYS
Definition: sync0types.h:355
@ LATCH_ID_SYNC_ARRAY_MUTEX
Definition: sync0types.h:423
@ LATCH_ID_TRX_SYS_SHARD
Definition: sync0types.h:416
@ LATCH_ID_REDO_LOG_ARCHIVE_ADMIN_MUTEX
Definition: sync0types.h:458
@ LATCH_ID_PAGE_ZIP_STAT_PER_INDEX
Definition: sync0types.h:420
@ LATCH_ID_BUF_POOL_FLUSH_STATE
Definition: sync0types.h:349
@ LATCH_ID_PERSIST_METADATA_BUFFER
Definition: sync0types.h:388
@ LATCH_ID_PAGE_CLEANER
Definition: sync0types.h:392
@ LATCH_ID_SRV_MONITOR_FILE
Definition: sync0types.h:408
@ LATCH_ID_DDL_AUTOINC
Definition: sync0types.h:352
@ LATCH_ID_SRV_SYS
Definition: sync0types.h:418
@ LATCH_ID_PARALLEL_READ
Definition: sync0types.h:456
@ LATCH_ID_RSEGS
Definition: sync0types.h:437
@ LATCH_ID_RTR_PATH_MUTEX
Definition: sync0types.h:404
@ LATCH_ID_BUF_POOL_FREE_LIST
Definition: sync0types.h:346
@ LATCH_ID_ZIP_PAD_MUTEX
Definition: sync0types.h:424
@ LATCH_ID_EVENT_MUTEX
Definition: sync0types.h:422
latch_meta_t::CounterType * sync_latch_get_counter(latch_id_t id)
Fetch the counter for the latch.
Definition: sync0types.h:888
const char * sync_basename(const char *filename)
Print the filename "basename".
Definition: sync0sync.cc:215
latch_level_t
Latching order levels.
Definition: sync0types.h:200
@ SYNC_TREE_NODE_NEW
Definition: sync0types.h:296
@ SYNC_LOG_WRITER
Definition: sync0types.h:246
@ SYNC_DICT
Definition: sync0types.h:310
@ SYNC_FTS_BG_THREADS
Definition: sync0types.h:239
@ SYNC_BUF_LRU_LIST
Definition: sync0types.h:228
@ SYNC_BUF_BLOCK
Definition: sync0types.h:226
@ SYNC_LOG_FLUSHER
Definition: sync0types.h:244
@ SYNC_DICT_AUTOINC_MUTEX
Definition: sync0types.h:309
@ SYNC_IBUF_BITMAP
Definition: sync0types.h:273
@ SYNC_POOL
Definition: sync0types.h:263
@ SYNC_LOG_FILES
Definition: sync0types.h:245
@ SYNC_BUF_CHUNKS
Definition: sync0types.h:229
@ SYNC_STATS_AUTO_RECALC
Definition: sync0types.h:308
@ SYNC_TRX_SYS
Definition: sync0types.h:266
@ SYNC_UNDO_SPACE_RSEG
Definition: sync0types.h:290
@ SYNC_BUF_ZIP_HASH
Definition: sync0types.h:223
@ SYNC_TREE_NODE
Definition: sync0types.h:294
@ SYNC_FSP_PAGE
Definition: sync0types.h:281
@ SYNC_FTS_CACHE_INIT
Definition: sync0types.h:240
@ SYNC_BUF_PAGE_HASH
Definition: sync0types.h:227
@ SYNC_TRX
Definition: sync0types.h:262
@ SYNC_LOG_WRITE_NOTIFIER
Definition: sync0types.h:247
@ SYNC_POOL_MANAGER
Definition: sync0types.h:264
@ SYNC_BUF_ZIP_FREE
Definition: sync0types.h:225
@ SYNC_FTS_TOKENIZE
Definition: sync0types.h:237
@ SYNC_MUTEX
Definition: sync0types.h:203
@ SYNC_TRX_SYS_SERIALISATION
Definition: sync0types.h:259
@ SYNC_PURGE_QUEUE
Definition: sync0types.h:260
@ SYNC_BUF_FLUSH_LIST
Definition: sync0types.h:221
@ SYNC_UNDO_SPACES
Definition: sync0types.h:299
@ SYNC_LOG_CLOSER
Definition: sync0types.h:249
@ SYNC_RSEG_ARRAY_HEADER
Definition: sync0types.h:285
@ SYNC_RECV_WRITER
Definition: sync0types.h:321
@ SYNC_FTS_CACHE
Definition: sync0types.h:312
@ SYNC_LOG_ARCH
Definition: sync0types.h:255
@ RW_LOCK_SX
Definition: sync0types.h:205
@ SYNC_LOCK_SYS_GLOBAL
Definition: sync0types.h:268
@ SYNC_DICT_HEADER
Definition: sync0types.h:306
@ SYNC_LOCK_SYS_SHARDED
Definition: sync0types.h:267
@ SYNC_PAGE_CLEANER
Definition: sync0types.h:257
@ SYNC_RSEG_HEADER
Definition: sync0types.h:287
@ SYNC_LOG_LIMITS
Definition: sync0types.h:243
@ SYNC_LEVEL_VARYING
Level is varying.
Definition: sync0types.h:327
@ SYNC_TRX_UNDO_PAGE
Definition: sync0types.h:286
@ SYNC_FIL_SHARD
Definition: sync0types.h:217
@ SYNC_TRX_SYS_SHARD
Definition: sync0types.h:265
@ SYNC_RECV
Definition: sync0types.h:241
@ SYNC_IBUF_PESS_INSERT_MUTEX
Definition: sync0types.h:304
@ SYNC_PERSIST_AUTOINC
Definition: sync0types.h:302
@ SYNC_TABLE
Definition: sync0types.h:307
@ SYNC_PAGE_ARCH
Definition: sync0types.h:253
@ SYNC_LOG_CHECKPOINTER
Definition: sync0types.h:250
@ SYNC_BUF_FLUSH_STATE
Definition: sync0types.h:222
@ SYNC_FSP
Definition: sync0types.h:282
@ SYNC_TRX_UNDO
Definition: sync0types.h:292
@ SYNC_TRX_I_S_LAST_READ
Definition: sync0types.h:317
@ SYNC_NO_ORDER_CHECK
This can be used to suppress order checking.
Definition: sync0types.h:330
@ SYNC_EXTERN_STORAGE
Definition: sync0types.h:284
@ SYNC_BUF_FREE_LIST
Definition: sync0types.h:224
@ SYNC_PARSER
Definition: sync0types.h:311
@ SYNC_IBUF_MUTEX
Definition: sync0types.h:279
@ SYNC_IBUF_HEADER
Definition: sync0types.h:305
@ SYNC_LOG_SN_MUTEX
Definition: sync0types.h:252
@ SYNC_LOCK_FREE_HASH
Definition: sync0types.h:211
@ SYNC_TRX_I_S_RWLOCK
Definition: sync0types.h:319
@ RW_LOCK_S
Definition: sync0types.h:207
@ SYNC_TEMP_SPACE_RSEG
Definition: sync0types.h:289
@ SYNC_TREE_NODE_FROM_HASH
Definition: sync0types.h:295
@ SYNC_PURGE_LATCH
Definition: sync0types.h:293
@ SYNC_MONITOR_MUTEX
Definition: sync0types.h:213
@ SYNC_PERSIST_DIRTY_TABLES
Definition: sync0types.h:301
@ SYNC_LOCK_WAIT_SYS
Definition: sync0types.h:269
@ SYNC_LOG_FLUSH_NOTIFIER
Definition: sync0types.h:248
@ SYNC_INDEX_ONLINE_LOG
Definition: sync0types.h:271
@ SYNC_TEMP_POOL_MANAGER
Definition: sync0types.h:283
@ SYNC_ANY_LATCH
Definition: sync0types.h:215
@ SYNC_FTS_OPTIMIZE
Definition: sync0types.h:238
@ SYNC_PAGE_ARCH_OPER
Definition: sync0types.h:219
@ SYNC_RSEG_HEADER_NEW
Definition: sync0types.h:288
@ SYNC_UNDO_DDL
Definition: sync0types.h:313
@ SYNC_IBUF_INDEX_TREE
Definition: sync0types.h:277
@ SYNC_DICT_OPERATION
Definition: sync0types.h:315
@ SYNC_TRX_SYS_HEADER
Definition: sync0types.h:258
@ SYNC_RSEGS
Definition: sync0types.h:298
@ SYNC_IBUF_TREE_NODE_NEW
Definition: sync0types.h:276
@ RW_LOCK_X
Definition: sync0types.h:208
@ SYNC_IBUF_TREE_NODE
Definition: sync0types.h:275
@ SYNC_THREADS
Definition: sync0types.h:261
@ SYNC_LEVEL_MAX
Maximum level value.
Definition: sync0types.h:333
@ SYNC_WORK_QUEUE
Definition: sync0types.h:235
@ SYNC_DBLWR
Definition: sync0types.h:231
@ RW_LOCK_NOT_LOCKED
Definition: sync0types.h:209
@ RW_LOCK_X_WAIT
Definition: sync0types.h:206
@ SYNC_PAGE_ARCH_CLIENT
Definition: sync0types.h:254
@ SYNC_IBUF_BITMAP_MUTEX
Definition: sync0types.h:274
@ SYNC_INDEX_TREE
Definition: sync0types.h:297
@ SYNC_SEARCH_SYS
Definition: sync0types.h:233
@ SYNC_TRX_SYS_RSEG
Definition: sync0types.h:291
@ SYNC_LOG_SN
Definition: sync0types.h:251
@ SYNC_UNKNOWN
Definition: sync0types.h:201
void sync_file_created_deregister(const void *ptr)
Deregister a latch, called when it is destroyed.
Definition: sync0debug.cc:1658
rw_lock_flag_t
Definition: sync0types.h:1216
@ RW_LOCK_FLAG_X
Definition: sync0types.h:1218
@ RW_LOCK_FLAG_SX
Definition: sync0types.h:1219
@ RW_LOCK_FLAG_S
Definition: sync0types.h:1217
mysql_pfs_key_t sync_latch_get_pfs_key(latch_id_t id)
Get the latch PFS key from the latch ID.
Definition: sync0types.h:916
latch_id_t sync_latch_get_id(const char *name)
Get the latch id from a latch name.
Definition: sync0debug.cc:992
bool innodb_calling_exit
Set when InnoDB has invoked exit().
Definition: srv0srv.cc:224
std::string sync_file_created_get(const void *ptr)
Get the string where the file was created.
Definition: sync0debug.cc:1665
ulint rw_lock_flags_t
Definition: sync0types.h:1213
Version control for database, common definitions, and include files.
#define UNIV_PFS_MUTEX
Definition: univ.i:130
#define UNIV_NOTHROW
Definition: univ.i:457
unsigned long int ulint
Definition: univ.i:407
Counter utility class.
#define ut_error
Abort execution.
Definition: ut0dbg.h:64
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:70
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:56
Base of InnoDB utilities.
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
#define UT_NEW_THIS_FILE_PSI_KEY
Definition: ut0new.h:562
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:506