 |
MySQL
8.0.23
Source Code Documentation
|
Go to the documentation of this file.
44 #ifndef UNIV_HOTBACKUP
53 #ifndef UNIV_HOTBACKUP
68 #define sync_check_iterate(A) true
71 #define rw_lock_s_lock(L) ((void)0)
72 #define rw_lock_s_unlock(L) ((void)0)
73 #define rw_lock_x_lock(L) ((void)0)
74 #define rw_lock_x_lock_nowait(L) true
75 #define rw_lock_x_unlock(L) ((void)0)
76 #define rw_lock_sx_lock(L) ((void)0)
77 #define rw_lock_sx_unlock(L) ((void)0)
78 #define rw_lock_s_lock_inline(M, P, F, L) ((void)0)
79 #define rw_lock_s_unlock_inline(M, P, F, L) ((void)0)
80 #define rw_lock_x_lock_inline(M, P, F, L) ((void)0)
81 #define rw_lock_x_unlock_inline(M, P, F, L) ((void)0)
82 #define rw_lock_sx_lock_inline(M, P, F, L) ((void)0)
83 #define rw_lock_sx_unlock_inline(M, P, F, L) ((void)0)
84 #define sync_check_lock(A, B) ((void)0)
85 #define rw_lock_s_lock_nowait(M, F, L) true
86 #define rw_lock_own_flagged(A, B) true
146 #define X_LOCK_DECR 0x20000000
147 #define X_LOCK_HALF_DECR 0x10000000
158 #ifndef UNIV_HOTBACKUP
164 #ifndef UNIV_HOTBACKUP
165 #ifndef UNIV_PFS_RWLOCK
173 #define rw_lock_create(K, L, level) \
174 rw_lock_create_func((L), (level), #L, __FILE__, __LINE__)
176 #define rw_lock_create(K, L, level) rw_lock_create_func((L), __FILE__, __LINE__)
182 #define rw_lock_s_lock(M) rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
184 #define rw_lock_s_lock_inline(M, P, F, L) \
185 rw_lock_s_lock_func((M), (P), (F), (L))
187 #define rw_lock_s_lock_gen(M, P) \
188 rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
190 #define rw_lock_s_lock_nowait(M, F, L) rw_lock_s_lock_low((M), 0, (F), (L))
193 #define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(P, L)
195 #define rw_lock_s_unlock_gen(L, P) rw_lock_s_unlock_func(L)
198 #define rw_lock_sx_lock(L) rw_lock_sx_lock_func((L), 0, __FILE__, __LINE__)
200 #define rw_lock_sx_lock_inline(M, P, F, L) \
201 rw_lock_sx_lock_func((M), (P), (F), (L))
203 #define rw_lock_sx_lock_gen(M, P) \
204 rw_lock_sx_lock_func((M), (P), __FILE__, __LINE__)
206 #define rw_lock_sx_lock_nowait(M, P) \
207 rw_lock_sx_lock_low((M), (P), __FILE__, __LINE__)
210 #define rw_lock_sx_unlock(L) rw_lock_sx_unlock_func(0, L)
211 #define rw_lock_sx_unlock_gen(L, P) rw_lock_sx_unlock_func(P, L)
213 #define rw_lock_sx_unlock(L) rw_lock_sx_unlock_func(L)
214 #define rw_lock_sx_unlock_gen(L, P) rw_lock_sx_unlock_func(L)
217 #define rw_lock_x_lock(M) rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
219 #define rw_lock_x_lock_inline(M, P, F, L) \
220 rw_lock_x_lock_func((M), (P), (F), (L))
222 #define rw_lock_x_lock_gen(M, P) \
223 rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
225 #define rw_lock_x_lock_nowait(M) \
226 rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
228 #define rw_lock_x_lock_func_nowait_inline(M, F, L) \
229 rw_lock_x_lock_func_nowait((M), (F), (L))
232 #define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(P, L)
234 #define rw_lock_x_unlock_gen(L, P) rw_lock_x_unlock_func(L)
237 #define rw_lock_free(M) rw_lock_free_func(M)
243 #define rw_lock_create(K, L, level) \
244 pfs_rw_lock_create_func((K), (L), (level), #L, __FILE__, __LINE__)
246 #define rw_lock_create(K, L, level) \
247 pfs_rw_lock_create_func((K), (L), __FILE__, __LINE__)
254 #define rw_lock_s_lock(M) pfs_rw_lock_s_lock_func((M), 0, __FILE__, __LINE__)
256 #define rw_lock_s_lock_inline(M, P, F, L) \
257 pfs_rw_lock_s_lock_func((M), (P), (F), (L))
259 #define rw_lock_s_lock_gen(M, P) \
260 pfs_rw_lock_s_lock_func((M), (P), __FILE__, __LINE__)
262 #define rw_lock_s_lock_nowait(M, F, L) pfs_rw_lock_s_lock_low((M), 0, (F), (L))
265 #define rw_lock_s_unlock_gen(L, P) pfs_rw_lock_s_unlock_func(P, L)
267 #define rw_lock_s_unlock_gen(L, P) pfs_rw_lock_s_unlock_func(L)
270 #define rw_lock_sx_lock(M) pfs_rw_lock_sx_lock_func((M), 0, __FILE__, __LINE__)
272 #define rw_lock_sx_lock_inline(M, P, F, L) \
273 pfs_rw_lock_sx_lock_func((M), (P), (F), (L))
275 #define rw_lock_sx_lock_gen(M, P) \
276 pfs_rw_lock_sx_lock_func((M), (P), __FILE__, __LINE__)
278 #define rw_lock_sx_lock_nowait(M, P) \
279 pfs_rw_lock_sx_lock_low((M), (P), __FILE__, __LINE__)
282 #define rw_lock_sx_unlock(L) pfs_rw_lock_sx_unlock_func(0, L)
283 #define rw_lock_sx_unlock_gen(L, P) pfs_rw_lock_sx_unlock_func(P, L)
285 #define rw_lock_sx_unlock(L) pfs_rw_lock_sx_unlock_func(L)
286 #define rw_lock_sx_unlock_gen(L, P) pfs_rw_lock_sx_unlock_func(L)
289 #define rw_lock_x_lock(M) pfs_rw_lock_x_lock_func((M), 0, __FILE__, __LINE__)
291 #define rw_lock_x_lock_inline(M, P, F, L) \
292 pfs_rw_lock_x_lock_func((M), (P), (F), (L))
294 #define rw_lock_x_lock_gen(M, P) \
295 pfs_rw_lock_x_lock_func((M), (P), __FILE__, __LINE__)
297 #define rw_lock_x_lock_nowait(M) \
298 pfs_rw_lock_x_lock_func_nowait((M), __FILE__, __LINE__)
300 #define rw_lock_x_lock_func_nowait_inline(M, F, L) \
301 pfs_rw_lock_x_lock_func_nowait((M), (F), (L))
304 #define rw_lock_x_unlock_gen(L, P) pfs_rw_lock_x_unlock_func(P, L)
306 #define rw_lock_x_unlock_gen(L, P) pfs_rw_lock_x_unlock_func(L)
309 #define rw_lock_free(M) pfs_rw_lock_free_func(M)
313 #define rw_lock_s_unlock(L) rw_lock_s_unlock_gen(L, 0)
314 #define rw_lock_x_unlock(L) rw_lock_x_unlock_gen(L, 0)
324 const char *cmutex_name,
326 const char *cfile_name,
515 #ifndef UNIV_HOTBACKUP
522 MY_ATTRIBUTE((warn_unused_result));
530 MY_ATTRIBUTE((warn_unused_result));
644 #ifdef UNIV_PFS_RWLOCK
656 virtual std::string
to_string()
const override;
688 #ifndef UNIV_HOTBACKUP
715 #ifdef UNIV_PFS_RWLOCK
734 const char *cfile_name, ulint cline);
836 const char *file_name, ulint line);
871 #include "sync0rw.ic"
UNIV_INLINE bool rw_lock_x_lock_func_nowait(rw_lock_t *lock, const char *file_name, ulint line)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for ...
uint64_counter_t rw_x_spin_wait_count
number of spin waits on rw-latches, resulted during exclusive (write) locks
Definition: sync0rw.h:107
uint32_t magic_n
Definition: sync0rw.h:661
UT_LIST_NODE_T(rw_lock_t) list
All allocated rw locks are put into a list.
std::atomic< int32_t > lock_word
Holds the state of the lock.
Definition: sync0rw.h:580
void rw_lock_x_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for ...
Definition: sync0rw.cc:622
ulint lock_type
Type of the lock: RW_LOCK_X, RW_LOCK_S, RW_LOCK_X_WAIT.
Definition: sync0rw.h:677
~rw_lock_t() override
Destructor.
Definition: sync0rw.h:651
const char * cfile_name
File name where lock created.
Definition: sync0rw.h:618
ibool rw_lock_own(rw_lock_t *lock, ulint lock_type)
Checks if the thread has locked the rw-lock in the specified mode, with the pass value == 0.
Definition: sync0rw.cc:924
volatile ulint sx_recursive
number of granted SX locks.
Definition: sync0rw.h:603
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:66
struct PSI_rwlock * pfs_psi
The instrumentation hook.
Definition: sync0rw.h:646
ulint rw_lock_flags_t
Definition: sync0types.h:1215
All (ordered) latches, used in debugging, must derive from this class.
Definition: sync0types.h:967
virtual std::string locked_from() const override
Print where it was locked from.
Definition: sync0rw.cc:1099
UNIV_INLINE ulint rw_lock_get_writer(const rw_lock_t *lock)
Returns the write-status of the lock - this function made more sense with the old rw_lock implementat...
InnoDB condition variable.
Definition: os0event.cc:66
std::atomic< os_thread_id_t > writer_thread
Thread id of writer thread.
Definition: sync0rw.h:608
UNIV_INLINE void pfs_rw_lock_free_func(rw_lock_t *lock)
Performance schema instrumented wrap function for rw_lock_free_func() NOTE! Please use the correspond...
ib_counter_t< uint64_t, IB_N_SLOTS > uint64_counter_t
Definition: sync0rw.h:91
typedef UT_LIST_BASE_NODE_T(rw_lock_t) rw_lock_list_t
ib_mutex_t rw_lock_list_mutex
Definition: sync0rw.cc:174
const char * last_x_file_name
File name where last x-locked.
Definition: sync0rw.h:624
virtual std::string to_string() const override
Print the rw-lock information.
Definition: sync0rw.cc:1128
UT_LIST_NODE_T(rw_lock_debug_t) list
Debug structs are linked in a two-way list.
UNIV_INLINE bool pfs_rw_lock_sx_lock_low(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_sx_lock_nowait() NOTE! Please use the corre...
ulint pass
Pass value given in the lock operation.
Definition: sync0rw.h:676
uint64_counter_t rw_s_spin_round_count
number of spin loop rounds on rw-latches, resulted during shared (read) locks
Definition: sync0rw.h:99
static const char * key
Definition: suite_stubs.c:14
bool rw_lock_sx_lock_low(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Low-level function for acquiring an sx lock.
Definition: sync0rw.cc:546
UNIV_INLINE void rw_lock_set_writer_id_and_recursion_flag(rw_lock_t *lock, bool recursive)
This function sets the lock->writer_thread and lock->recursive fields.
UNIV_INLINE void pfs_rw_lock_s_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the correspo...
Interface for an instrumented rwlock.
Definition: psi_rwlock_bits.h:70
UNIV_INLINE void pfs_rw_lock_create_func(mysql_pfs_key_t key, rw_lock_t *lock, latch_level_t level, const char *cmutex_name, const char *cfile_name, ulint cline)
Performance schema instrumented wrap function for rw_lock_create_func() NOTE! Please use the correspo...
void rw_lock_free_func(rw_lock_t *lock)
Calling this function is obligatory only if the memory buffer containing the rw-lock is freed.
Definition: sync0rw.cc:267
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:78
void rw_lock_debug_print(FILE *f, const rw_lock_debug_t *info)
Prints info of a debug struct.
Definition: sync0rw.cc:1066
UNIV_INLINE void rw_lock_x_unlock_func(ulint pass, rw_lock_t *lock)
Releases an exclusive mode lock.
UNIV_INLINE void rw_lock_s_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
NOTE! Use the corresponding macro, not directly this function, except if you supply the file name and...
uint64_counter_t rw_x_os_wait_count
number of OS waits on rw-latches, resulted during exclusive (write) locks
Definition: sync0rw.h:115
Counters for RW locks.
Definition: sync0rw.h:90
UNIV_INLINE ulint rw_lock_get_sx_lock_count(const rw_lock_t *lock)
Returns the number of sx-lock for the lock.
@ RW_SX_LATCH
Definition: sync0rw.h:138
uint64_counter_t rw_sx_spin_wait_count
number of spin waits on rw-latches, resulted during sx locks
Definition: sync0rw.h:119
bool is_block_lock
If 1 then the rw-lock is a block lock.
Definition: sync0rw.h:630
@ RW_S_LATCH
Definition: sync0rw.h:136
UNIV_INLINE lint rw_lock_lock_word_incr(rw_lock_t *lock, ulint amount)
Increments lock_word the specified amount and returns new value.
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list
In the debug version: pointer to the debug info list of the lock.
rw_lock_t(const rw_lock_t &)=delete
rw_lock_t is not a copyable object, the reasoning behind this is the same as the reasoning behind why...
UNIV_INLINE bool rw_lock_lock_word_decr(rw_lock_t *lock, ulint amount, lint threshold)
Decrements lock_word the specified amount if it is greater than 0.
uint16_t last_x_line
Line number where last time x-locked.
Definition: sync0rw.h:636
ulint line
Line where the rw-lock was locked.
Definition: sync0rw.h:680
@ RW_X_LATCH
Definition: sync0rw.h:137
latch_level_t level
Level in the global latching order.
Definition: sync0rw.h:667
uint16_t cline
Line where created.
Definition: sync0rw.h:627
uint16_t last_s_line
Line number where last time s-locked.
Definition: sync0rw.h:633
const char * last_s_file_name
last s-lock file/line is not guaranteed to be correct
Definition: sync0rw.h:621
Define for performance schema registration key.
Definition: sync0sync.h:50
@ RW_NO_LATCH
Definition: sync0rw.h:139
uint64_counter_t rw_x_spin_round_count
number of spin loop rounds on rw-latches, resulted during exclusive (write) locks
Definition: sync0rw.h:111
std::atomic< bool > recursive
Default value FALSE which means the lock is non-recursive.
Definition: sync0rw.h:594
void rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in SX mode for the cur...
Definition: sync0rw.cc:717
UNIV_INLINE void pfs_rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_sx_lock_func() NOTE! Please use the corresp...
uint64_counter_t rw_s_spin_wait_count
number of spin waits on rw-latches, resulted during shared (read) locks
Definition: sync0rw.h:95
const std::string FILE("FILE")
bool rw_lock_own_flagged(const rw_lock_t *lock, rw_lock_flags_t flags)
Checks if the thread has locked the rw-lock in the specified mode, with the pass value == 0.
Definition: sync0rw.cc:978
rw_lock_type_t
Definition: sync0rw.h:135
UNIV_INLINE void pfs_rw_lock_x_lock_func(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_x_lock_func() NOTE! Please use the correspo...
void rw_lock_create_func(rw_lock_t *lock, latch_level_t level, const char *cmutex_name, const char *cfile_name, ulint cline)
Creates, or rather, initializes an rw-lock object in a specified memory location (which must be appro...
Definition: sync0rw.cc:196
UNIV_INLINE void pfs_rw_lock_sx_unlock_func(ulint pass, rw_lock_t *lock)
Performance schema instrumented wrap function for rw_lock_sx_unlock_func() NOTE! Please use the corre...
static const uint32_t MAGIC_N
For checking memory corruption.
Definition: sync0rw.h:660
os_event_t wait_ex_event
Event for next-writer to wait on.
Definition: sync0rw.h:615
UNIV_INLINE ulint rw_lock_get_reader_count(const rw_lock_t *lock)
Returns the number of readers (s-locks).
rw_lock_t & operator=(const rw_lock_t &)=delete
rw_lock_stats_t rw_lock_stats
Counters for RW locks.
Definition: sync0rw.cc:170
uint64_counter_t rw_s_os_wait_count
number of OS waits on rw-latches, resulted during shared (read) locks
Definition: sync0rw.h:103
uint64_counter_t rw_sx_os_wait_count
number of OS waits on rw-latches, resulted during sx locks
Definition: sync0rw.h:127
bool writer_is_wait_ex
This is TRUE if the writer field is RW_LOCK_X_WAIT; this field is located far from the memory update ...
Definition: sync0rw.h:600
void rw_lock_list_print_info(FILE *file)
Prints debug info of currently locked rw-locks.
Definition: sync0rw.cc:1021
const char * file_name
File name where the lock was obtained.
Definition: sync0rw.h:679
rw_lock_list_t rw_lock_list
Definition: sync0rw.cc:173
bool rw_lock_validate(const rw_lock_t *lock)
Checks that the rw-lock has been initialized and that there are no simultaneous shared and exclusive ...
Definition: sync0rw.cc:809
UNIV_INLINE bool pfs_rw_lock_x_lock_func_nowait(rw_lock_t *lock, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_x_lock_func_nowait() NOTE!...
UNIV_INLINE bool rw_lock_s_lock_low(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Low-level function which tries to lock an rw-lock in s-mode.
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:568
The structure for storing debug info of an rw-lock.
Definition: sync0rw.h:673
os_thread_id_t thread_id
The thread id of the thread which locked the rw-lock.
Definition: sync0rw.h:674
uint64_counter_t rw_sx_spin_round_count
number of spin loop rounds on rw-latches, resulted during sx locks
Definition: sync0rw.h:123
bool rw_lock_is_locked(rw_lock_t *lock, ulint lock_type)
Checks if somebody has locked the rw-lock in the specified mode.
Definition: sync0rw.cc:825
latch_level_t
Latching order levels.
Definition: sync0types.h:217
std::thread::native_handle_type os_thread_id_t
Operating system thread native handle.
Definition: os0thread.h:64
UNIV_INLINE ulint rw_lock_get_x_lock_count(const rw_lock_t *lock)
Returns the value of writer_count for the lock.
std::atomic< bool > waiters
1: there are waiters
Definition: sync0rw.h:583
UNIV_INLINE void rw_lock_sx_unlock_func(ulint pass, rw_lock_t *lock)
Releases an sx mode lock.
UNIV_INLINE void pfs_rw_lock_x_unlock_func(ulint pass, rw_lock_t *lock)
Performance schema instrumented wrap function for rw_lock_x_unlock_func() NOTE! Please use the corres...
UNIV_INLINE bool rw_lock_get_waiters(const rw_lock_t *lock)
Check if there are threads waiting for the rw-lock.
UNIV_INLINE void rw_lock_s_unlock_func(ulint pass, rw_lock_t *lock)
Releases a shared mode lock.
void rw_lock_x_lock_move_ownership(rw_lock_t *lock)
This function is used in the insert buffer to move the ownership of an x-latch on a buffer frame to t...
Definition: sync0rw.cc:390
UNIV_INLINE ibool pfs_rw_lock_s_lock_low(rw_lock_t *lock, ulint pass, const char *file_name, ulint line)
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the correspo...
UNIV_INLINE void pfs_rw_lock_s_unlock_func(ulint pass, rw_lock_t *lock)
Performance schema instrumented wrap function for rw_lock_s_unlock_func() NOTE! Please use the corres...
os_event_t event
Used by sync0arr.cc for thread queueing.
Definition: sync0rw.h:611
uint32_t count_os_wait
Count of os_waits.
Definition: sync0rw.h:639
static int flags[50]
Definition: hp_test1.cc:39