67 return (
lock !=
nullptr);
70#define sync_check_iterate(A) true
73#define rw_lock_s_lock(L, Loc) ((void)0)
74#define rw_lock_s_lock_nowait(L, Loc) true
75#define rw_lock_s_unlock(L) ((void)0)
76#define rw_lock_x_lock(L, Loc) ((void)0)
77#define rw_lock_x_lock_nowait(L, Loc) true
78#define rw_lock_x_unlock(L) ((void)0)
79#define rw_lock_sx_lock(L, Loc) ((void)0)
80#define rw_lock_sx_unlock(L) ((void)0)
81#define rw_lock_s_lock_gen(M, P, L) ((void)0)
82#define rw_lock_x_lock_gen(M, P, L) ((void)0)
83#define rw_lock_sx_lock_gen(M, P, L) ((void)0)
84#define sync_check_lock(A, B) ((void)0)
85#define rw_lock_own_flagged(A, B) true
115#ifndef UNIV_HOTBACKUP
430#ifdef UNIV_PFS_RWLOCK
442 virtual std::string
to_string()
const override;
465#ifndef UNIV_HOTBACKUP
492#ifdef UNIV_PFS_RWLOCK
608#ifndef UNIV_PFS_RWLOCK
616#define rw_lock_create(K, L, ID) \
617 rw_lock_create_func((L), (ID), UT_LOCATION_HERE)
619#define rw_lock_create(K, L, ID) rw_lock_create_func((L), UT_LOCATION_HERE)
698#define rw_lock_free(M) rw_lock_free_func(M)
704#define rw_lock_create(K, L, ID) \
705 pfs_rw_lock_create_func((K), (L), (ID), UT_LOCATION_HERE)
707#define rw_lock_create(K, L, ID) \
708 pfs_rw_lock_create_func((K), (L), UT_LOCATION_HERE)
#define M
Definition: ctype-tis620.cc:74
#define L
Definition: ctype-tis620.cc:76
#define P
Definition: dtoa.cc:619
static int flags[50]
Definition: hp_test1.cc:40
const std::string FILE("FILE")
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2878
The interface to the operating system condition variables.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Interface for an instrumented rwlock.
Definition: psi_rwlock_bits.h:71
All (ordered) latches, used in debugging, must derive from this class.
Definition: sync0types.h:960
Define for performance schema registration key.
Definition: sync0sync.h:51
InnoDB condition variable.
Definition: os0event.cc:63
The structure for storing debug info of an rw-lock.
Definition: sync0rw.h:331
ulint lock_type
Type of the lock: RW_LOCK_X, RW_LOCK_S, RW_LOCK_X_WAIT.
Definition: sync0rw.h:337
ut::Location location
Location where the rw-lock was locked.
Definition: sync0rw.h:339
UT_LIST_NODE_T(rw_lock_debug_t) list
Debug structs are linked in a two-way list.
std::thread::id thread_id
The thread id of the thread which locked the rw-lock.
Definition: sync0rw.h:333
ulint pass
Pass value given in the lock operation.
Definition: sync0rw.h:335
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:360
std::atomic< std::thread::id > writer_thread
Thread id of writer thread.
Definition: sync0rw.h:393
uint16_t last_x_line
Line number where last time x-locked.
Definition: sync0rw.h:422
static const uint32_t MAGIC_N
For checking memory corruption.
Definition: sync0rw.h:446
virtual std::string locked_from() const override
Print where it was locked from.
Definition: sync0rw.cc:1011
std::atomic< bool > waiters
1: there are waiters
Definition: sync0rw.h:374
bool is_x_blocked_by_s()
Checks if there is a thread requesting an x-latch waiting for threads to release their s-latches.
Definition: sync0rw.h:457
const char * last_s_file_name
last s-lock file/line is not guaranteed to be correct
Definition: sync0rw.h:410
os_event_t wait_ex_event
Event for next-writer to wait on.
Definition: sync0rw.h:404
volatile ulint sx_recursive
number of granted SX locks.
Definition: sync0rw.h:388
bool is_block_lock
If 1 then the rw-lock is a block lock.
Definition: sync0rw.h:416
uint32_t count_os_wait
Count of os_waits.
Definition: sync0rw.h:425
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...
uint16_t last_s_line
Line number where last time s-locked.
Definition: sync0rw.h:419
struct PSI_rwlock * pfs_psi
The instrumentation hook.
Definition: sync0rw.h:432
rw_lock_t & operator=(const rw_lock_t &)=delete
os_event_t event
Used by sync0arr.cc for thread queueing.
Definition: sync0rw.h:400
const char * last_x_file_name
File name where last x-locked.
Definition: sync0rw.h:413
Atomic_xor_of_thread_id reader_thread
XOR of reader threads' IDs.
Definition: sync0rw.h:397
virtual std::string to_string() const override
Print the rw-lock information.
Definition: sync0rw.cc:1037
~rw_lock_t() override
Destructor.
Definition: sync0rw.cc:254
ut::Location clocation
Location where lock created.
Definition: sync0rw.h:407
std::atomic< int32_t > lock_word
Holds the state of the lock.
Definition: sync0rw.h:371
UT_LIST_NODE_T(rw_lock_t) list
All allocated rw locks are put into a list.
UT_LIST_BASE_NODE_T(rw_lock_debug_t, list) debug_list
In the debug version: pointer to the debug info list of the lock.
Definition: sync0rw.h:450
uint32_t magic_n
Definition: sync0rw.h:447
std::atomic< bool > recursive
Default value false which means the lock is non-recursive.
Definition: sync0rw.h:385
static 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.
Definition: sync0rw.ic:211
static lint rw_lock_lock_word_incr(rw_lock_t *lock, ulint amount)
Increments lock_word the specified amount and returns new value.
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:729
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:248
static void rw_lock_sx_unlock_func(ulint pass, rw_lock_t *lock)
Releases an sx mode lock.
static void rw_lock_s_unlock_func(ulint pass, rw_lock_t *lock)
Releases a shared mode lock.
static bool pfs_rw_lock_x_lock_func_nowait(rw_lock_t *lock, ut::Location location)
Performance schema instrumented wrap function for rw_lock_x_lock_func_nowait() NOTE!...
bool rw_lock_own(const 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:858
static 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.
static void rw_lock_s_unlock(rw_lock_t *L)
Definition: sync0rw.h:792
constexpr int32_t X_LOCK_HALF_DECR
Definition: sync0rw.h:106
static void rw_lock_x_lock(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:766
static bool pfs_rw_lock_sx_lock_low(rw_lock_t *lock, ulint pass, ut::Location location)
Performance schema instrumented wrap function for rw_lock_sx_lock_nowait() NOTE! Please use the corre...
static 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...
static void rw_lock_x_lock_gen(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:770
static bool rw_lock_s_lock_nowait(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:723
static void rw_lock_x_unlock_gen(rw_lock_t *L, ulint P)
Definition: sync0rw.h:779
static bool rw_lock_x_lock_func_nowait(rw_lock_t *lock, ut::Location location)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for ...
static bool rw_lock_get_waiters(const rw_lock_t *lock)
Check if there are threads waiting for the rw-lock.
static void rw_lock_sx_lock_gen(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:741
static 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...
static void pfs_rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
Performance schema instrumented wrap function for rw_lock_sx_lock_func() NOTE! Please use the corresp...
static bool rw_lock_s_lock_low(rw_lock_t *lock, ulint pass, ut::Location location)
Low-level function which tries to lock an rw-lock in s-mode.
Definition: sync0rw.ic:245
static void pfs_rw_lock_create_func(mysql_pfs_key_t key, rw_lock_t *lock, latch_id_t id, ut::Location clocation)
Performance schema instrumented wrap function for rw_lock_create_func() NOTE! Please use the correspo...
static ulint rw_lock_get_sx_lock_count(const rw_lock_t *lock)
Returns the number of sx-lock for the lock.
static bool rw_lock_x_lock_nowait(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:774
static ulint rw_lock_get_reader_count(const rw_lock_t *lock)
Returns the number of readers (s-locks).
void rw_lock_debug_print(FILE *f, const rw_lock_debug_t *info)
Prints info of a debug struct.
Definition: sync0rw.cc:978
static bool pfs_rw_lock_s_lock_low(rw_lock_t *lock, ulint pass, ut::Location location)
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the correspo...
rw_lock_list_t rw_lock_list
The global list of rw-locks.
Definition: sync0rw.cc:171
typedef UT_LIST_BASE_NODE_T(rw_lock_t, list) rw_lock_list_t
static void rw_lock_s_lock(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:715
static 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...
static 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...
bool rw_lock_sx_lock_low(rw_lock_t *lock, ulint pass, ut::Location location)
Low-level function for acquiring an sx lock.
Definition: sync0rw.cc:510
static void rw_lock_s_unlock_gen(rw_lock_t *L, ulint P)
Definition: sync0rw.h:728
static void rw_lock_x_unlock(rw_lock_t *L)
Definition: sync0rw.h:795
static void rw_lock_sx_unlock_gen(rw_lock_t *L, ulint P)
Definition: sync0rw.h:754
void rw_lock_sx_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in SX mode for the cur...
Definition: sync0rw.cc:643
ib_mutex_t rw_lock_list_mutex
Definition: sync0rw.cc:172
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:713
void rw_lock_list_print_info(FILE *file)
Prints debug info of currently locked rw-locks.
Definition: sync0rw.cc:937
static void pfs_rw_lock_x_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
Performance schema instrumented wrap function for rw_lock_x_lock_func() NOTE! Please use the correspo...
static void rw_lock_x_unlock_func(ulint pass, rw_lock_t *lock)
Releases an exclusive mode lock.
constexpr int32_t X_LOCK_DECR
Definition: sync0rw.h:105
static ulint rw_lock_get_x_lock_count(const rw_lock_t *lock)
Returns the value of writer_count for the lock.
static void rw_lock_s_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
NOTE! Use the corresponding macro, not directly this function, except if you supply the file name and...
rw_lock_type_t
Definition: sync0rw.h:94
@ RW_SX_LATCH
Definition: sync0rw.h:97
@ RW_NO_LATCH
Definition: sync0rw.h:98
@ RW_X_LATCH
Definition: sync0rw.h:96
@ RW_S_LATCH
Definition: sync0rw.h:95
static void pfs_rw_lock_s_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the correspo...
Definition: sync0rw.ic:570
static void rw_lock_sx_unlock(rw_lock_t *L)
Definition: sync0rw.h:751
static void rw_lock_s_lock_gen(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:719
void rw_lock_create_func(rw_lock_t *lock, latch_id_t id, ut::Location clocation)
Creates, or rather, initializes an rw-lock object in a specified memory location (which must be appro...
Definition: sync0rw.cc:191
static void rw_lock_sx_lock(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:737
static bool rw_lock_sx_lock_nowait(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:745
static 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...
Definition: sync0rw.ic:722
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:898
void rw_lock_x_lock_func(rw_lock_t *lock, ulint pass, ut::Location location)
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for ...
Definition: sync0rw.cc:573
static void rw_lock_free(rw_lock_t *M)
Definition: sync0rw.h:788
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:355
The read-write lock (for threads)
latch_id_t
Each latch has an ID.
Definition: sync0types.h:342
ulint rw_lock_flags_t
Definition: sync0types.h:1206
Version control for database, common definitions, and include files.
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
long int lint
Definition: univ.i:407
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510