MySQL 9.1.0
Source Code Documentation
locksys::Latches::Table_shards Class Reference

Public Member Functions

 Table_shards ()
 
 ~Table_shards ()
 
Lock_mutexget_mutex (const table_id_t table_id)
 Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table. More...
 
const Lock_mutexget_mutex (const table_id_t table_id) const
 Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table. More...
 
const Lock_mutexget_mutex (const dict_table_t &table) const
 Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table. More...
 

Static Private Member Functions

static size_t get_shard (const table_id_t table_id)
 Identifies the table shard which contains locks for the given table. More...
 

Private Attributes

Padded_mutex mutexes [SHARDS_COUNT]
 Each shard is protected by a separate mutex. More...
 

Constructor & Destructor Documentation

◆ Table_shards()

locksys::Latches::Table_shards::Table_shards ( )

◆ ~Table_shards()

locksys::Latches::Table_shards::~Table_shards ( )

Member Function Documentation

◆ get_mutex() [1/3]

const Lock_mutex & locksys::Latches::Table_shards::get_mutex ( const dict_table_t table) const

Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table.

Parameters
[in]tableThe table
Returns
The mutex responsible for the shard containing the table

◆ get_mutex() [2/3]

Lock_mutex & locksys::Latches::Table_shards::get_mutex ( const table_id_t  table_id)

Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table.

Parameters
[in]table_idThe id of the table
Returns
The mutex responsible for the shard containing the table

◆ get_mutex() [3/3]

const Lock_mutex & locksys::Latches::Table_shards::get_mutex ( const table_id_t  table_id) const

Returns the mutex which (together with the global latch) protects the table shard which contains table locks for the given table.

Parameters
[in]table_idThe id of the table
Returns
The mutex responsible for the shard containing the table

◆ get_shard()

size_t locksys::Latches::Table_shards::get_shard ( const table_id_t  table_id)
staticprivate

Identifies the table shard which contains locks for the given table.

Parameters
[in]table_idThe id of the table
Returns
Integer in the range [0..lock_sys_t::SHARDS_COUNT)

Member Data Documentation

◆ mutexes

Padded_mutex locksys::Latches::Table_shards::mutexes[SHARDS_COUNT]
private

Each shard is protected by a separate mutex.

Mutexes are padded to avoid false sharing issues with cache.


The documentation for this class was generated from the following files: