70 return (
lock !=
nullptr);
73#define sync_check_iterate(A) true
76#define rw_lock_s_lock(L, Loc) ((void)0)
77#define rw_lock_s_lock_nowait(L, Loc) true
78#define rw_lock_s_unlock(L) ((void)0)
79#define rw_lock_x_lock(L, Loc) ((void)0)
80#define rw_lock_x_lock_nowait(L, Loc) true
81#define rw_lock_x_unlock(L) ((void)0)
82#define rw_lock_sx_lock(L, Loc) ((void)0)
83#define rw_lock_sx_unlock(L) ((void)0)
84#define rw_lock_s_lock_gen(M, P, L) ((void)0)
85#define rw_lock_x_lock_gen(M, P, L) ((void)0)
86#define rw_lock_sx_lock_gen(M, P, L) ((void)0)
87#define sync_check_lock(A, B) ((void)0)
88#define rw_lock_own_flagged(A, B) true
118#ifndef UNIV_HOTBACKUP
394 auto old_value =
sx_recursive.load(std::memory_order_relaxed);
395 auto new_value = old_value - 1;
396 sx_recursive.store(new_value, std::memory_order_relaxed);
400 auto old_value =
sx_recursive.load(std::memory_order_relaxed);
401 auto new_value = old_value + 1;
402 sx_recursive.store(new_value, std::memory_order_relaxed);
446#ifdef UNIV_PFS_RWLOCK
458 virtual std::string
to_string()
const override;
481#ifndef UNIV_HOTBACKUP
508#ifdef UNIV_PFS_RWLOCK
624#ifndef UNIV_PFS_RWLOCK
632#define rw_lock_create(K, L, ID) \
633 rw_lock_create_func((L), (ID), UT_LOCATION_HERE)
635#define rw_lock_create(K, L, ID) rw_lock_create_func((L), UT_LOCATION_HERE)
714#define rw_lock_free(M) rw_lock_free_func(M)
720#define rw_lock_create(K, L, ID) \
721 pfs_rw_lock_create_func((K), (L), (ID), UT_LOCATION_HERE)
723#define rw_lock_create(K, L, ID) \
724 pfs_rw_lock_create_func((K), (L), UT_LOCATION_HERE)
#define M
Definition: ctype-tis620.cc:73
#define L
Definition: ctype-tis620.cc:75
#define P
Definition: dtoa.cc:620
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:2880
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:965
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:334
ulint lock_type
Type of the lock: RW_LOCK_X, RW_LOCK_S, RW_LOCK_X_WAIT.
Definition: sync0rw.h:340
ut::Location location
Location where the rw-lock was locked.
Definition: sync0rw.h:342
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:336
ulint pass
Pass value given in the lock operation.
Definition: sync0rw.h:338
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:363
std::atomic< uint64_t > sx_recursive
number of granted SX locks.
Definition: sync0rw.h:391
std::atomic< std::thread::id > writer_thread
Thread id of writer thread.
Definition: sync0rw.h:409
uint16_t last_x_line
Line number where last time x-locked.
Definition: sync0rw.h:438
static const uint32_t MAGIC_N
For checking memory corruption.
Definition: sync0rw.h:462
virtual std::string locked_from() const override
Print where it was locked from.
Definition: sync0rw.cc:1011
uint64_t increment_sx_recursive()
Definition: sync0rw.h:399
std::atomic< bool > waiters
1: there are waiters
Definition: sync0rw.h:377
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:473
const char * last_s_file_name
last s-lock file/line is not guaranteed to be correct
Definition: sync0rw.h:426
os_event_t wait_ex_event
Event for next-writer to wait on.
Definition: sync0rw.h:420
bool is_block_lock
If 1 then the rw-lock is a block lock.
Definition: sync0rw.h:432
uint32_t count_os_wait
Count of os_waits.
Definition: sync0rw.h:441
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:435
void decrement_sx_recursive()
Definition: sync0rw.h:393
struct PSI_rwlock * pfs_psi
The instrumentation hook.
Definition: sync0rw.h:448
rw_lock_t & operator=(const rw_lock_t &)=delete
os_event_t event
Used by sync0arr.cc for thread queueing.
Definition: sync0rw.h:416
const char * last_x_file_name
File name where last x-locked.
Definition: sync0rw.h:429
Atomic_xor_of_thread_id reader_thread
XOR of reader threads' IDs.
Definition: sync0rw.h:413
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:423
std::atomic< int32_t > lock_word
Holds the state of the lock.
Definition: sync0rw.h:374
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:466
uint32_t magic_n
Definition: sync0rw.h:463
std::atomic< bool > recursive
Default value false which means the lock is non-recursive.
Definition: sync0rw.h:388
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:808
constexpr int32_t X_LOCK_HALF_DECR
Definition: sync0rw.h:109
static void rw_lock_x_lock(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:782
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:786
static bool rw_lock_s_lock_nowait(rw_lock_t *M, ut::Location L)
Definition: sync0rw.h:739
static void rw_lock_x_unlock_gen(rw_lock_t *L, ulint P)
Definition: sync0rw.h:795
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:757
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:790
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:731
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:744
static void rw_lock_x_unlock(rw_lock_t *L)
Definition: sync0rw.h:811
static void rw_lock_sx_unlock_gen(rw_lock_t *L, ulint P)
Definition: sync0rw.h:770
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:108
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:97
@ RW_SX_LATCH
Definition: sync0rw.h:100
@ RW_NO_LATCH
Definition: sync0rw.h:101
@ RW_X_LATCH
Definition: sync0rw.h:99
@ RW_S_LATCH
Definition: sync0rw.h:98
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:767
static void rw_lock_s_lock_gen(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:735
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:753
static bool rw_lock_sx_lock_nowait(rw_lock_t *M, ulint P, ut::Location L)
Definition: sync0rw.h:761
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:804
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:345
ulint rw_lock_flags_t
Definition: sync0types.h:1211
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