121 static constexpr size_t NOT_IN_USE = std::numeric_limits<size_t>::max();
Rw-lock with very fast, highly concurrent s-lock but slower x-lock.
Definition: sync0sharded_rw.h:63
bool s_own(size_t shard_no) const
Definition: sync0sharded_rw.h:143
void x_unlock()
Definition: sync0sharded_rw.h:138
size_t s_lock(ut::Location location)
Definition: sync0sharded_rw.h:96
void s_unlock(size_t shard_no)
Definition: sync0sharded_rw.h:103
bool x_own() const
Definition: sync0sharded_rw.h:147
bool try_x_lock(ut::Location location)
Tries to obtain exclusive latch - similar to x_lock(), but non-blocking, and thus can fail.
Definition: sync0sharded_rw.h:120
bool is_x_blocked_by_s(size_t shard_no)
Checks if there is a thread requesting an x-latch waiting for threads to release their s-latches on g...
Definition: sync0sharded_rw.h:111
void x_lock(ut::Location location)
Definition: sync0sharded_rw.h:132
A RAII helper which latches global_latch in exclusive mode during constructor, and unlatches it durin...
Definition: lock0guards.h:40
A RAII helper which tries to exclusively latch the global_lach in constructor and unlatches it,...
Definition: lock0guards.h:51
A RAII helper which latches global_latch in shared mode during constructor, and unlatches it during d...
Definition: lock0guards.h:71
Definition: lock0latches.h:176
Page_shards()
Definition: lock0latches.cc:102
static size_t get_shard(const page_id_t &page_id)
Identifies the page shard which contains record locks for records from the given page.
Definition: lock0latches.cc:36
~Page_shards()
Definition: lock0latches.cc:108
const Lock_mutex & get_mutex(const page_id_t &page_id) const
Returns the mutex which (together with the global latch) protects the page shard which contains recor...
Definition: lock0latches.cc:53
Padded_mutex mutexes[SHARDS_COUNT]
Each shard is protected by a separate mutex.
Definition: lock0latches.h:179
Definition: lock0latches.h:223
static size_t get_shard(const table_id_t table_id)
Identifies the table shard which contains locks for the given table.
Definition: lock0latches.cc:69
Table_shards()
Definition: lock0latches.cc:114
Padded_mutex mutexes[SHARDS_COUNT]
Each shard is protected by a separate mutex.
Definition: lock0latches.h:226
Lock_mutex & get_mutex(const table_id_t table_id)
Returns the mutex which (together with the global latch) protects the table shard which contains tabl...
Definition: lock0latches.cc:78
~Table_shards()
Definition: lock0latches.cc:120
A helper wrapper around Shared_rw_lock which simplifies:
Definition: lock0latches.h:115
bool is_x_blocked_by_our_s()
Checks if there is a thread requesting an x-latch waiting for our thread to release its s-latch.
Definition: lock0latches.h:137
Sharded_rw_lock rw_lock
The actual rw_lock implementation doing the heavy lifting.
Definition: lock0latches.h:117
Unique_sharded_rw_lock()
Definition: lock0latches.cc:92
void x_lock(ut::Location location)
Definition: lock0latches.h:141
bool s_own() const
Definition: lock0latches.h:154
static constexpr size_t NOT_IN_USE
The value used for m_shard_id to indicate that current thread did not s-latch any of the rw_lock's sh...
Definition: lock0latches.h:121
static thread_local size_t m_shard_id
The id of the rw_lock's shard which this thread has s-latched, or NOT_IN_USE if it has not s-latched ...
Definition: lock0latches.h:125
bool x_own() const
Definition: lock0latches.h:153
void s_lock(ut::Location location)
Definition: lock0latches.h:143
bool try_x_lock(ut::Location location)
Definition: lock0latches.h:130
void s_unlock()
Definition: lock0latches.h:147
~Unique_sharded_rw_lock()
Definition: lock0latches.cc:100
void x_unlock()
Definition: lock0latches.h:142
The class which handles the logic of latching of lock_sys queues themselves.
Definition: lock0latches.h:103
Page_shards page_shards
Definition: lock0latches.h:266
static constexpr size_t SHARDS_COUNT
Number of page shards, and also number of table shards.
Definition: lock0latches.h:165
char pad1[ut::INNODB_CACHE_LINE_SIZE]
padding to prevent other memory update hotspots from residing on the same memory cache line
Definition: lock0latches.h:262
ib_mutex_t Lock_mutex
Definition: lock0latches.h:105
bool owns_table_shard(const dict_table_t &table) const
Tests if given table shard can be safely accessed by the current thread.
Definition: lock0latches.h:316
Unique_sharded_rw_lock global_latch
Definition: lock0latches.h:264
bool owns_shared_global_latch() const
Tests if lock_sys latch is owned in shared mode by the current thread.
Definition: lock0latches.h:296
bool owns_page_shard(const page_id_t &page_id) const
Tests if given page shard can be safely accessed by the current thread.
Definition: lock0latches.h:304
bool owns_exclusive_global_latch() const
Tests if lock_sys latch is exclusively owned by the current thread.
Definition: lock0latches.h:290
Table_shards table_shards
Definition: lock0latches.h:268
A RAII helper which latches the mutex protecting given shard during constructor, and unlatches it dur...
Definition: lock0guards.h:91
A RAII helper which latches the mutexes protecting specified shards for the duration of its scope.
Definition: lock0guards.h:144
Definition: lock0priv.h:1008
Page identifier.
Definition: buf0types.h:207
Data dictionary global types.
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:232
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: lock0guards.h:34
constexpr size_t INNODB_CACHE_LINE_SIZE
CPU cache line size.
Definition: ut0cpu_cache.h:41
Data structure for a database table.
Definition: dict0mem.h:1904
The sharded read-write lock (for threads).
Utilities related to CPU cache.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105