MySQL 9.1.0
Source Code Documentation
|
A RAII helper which latches the mutexes protecting specified shards for the duration of its scope. More...
#include <lock0guards.h>
Public Member Functions | |
Shard_naked_latches_guard (const buf_block_t &block_a, const buf_block_t &block_b) | |
~Shard_naked_latches_guard () | |
Private Member Functions | |
Shard_naked_latches_guard (Lock_mutex &shard_mutex_a, Lock_mutex &shard_mutex_b) | |
Private Attributes | |
Lock_mutex & | m_shard_mutex_1 |
The "smallest" of the two shards' mutexes in the latching order. More... | |
Lock_mutex & | m_shard_mutex_2 |
The "largest" of the two shards' mutexes in the latching order. More... | |
Static Private Attributes | |
static constexpr std::less< Lock_mutex * > | MUTEX_ORDER {} |
The ordering on shard mutexes used to avoid deadlocks. More... | |
A RAII helper which latches the mutexes protecting specified shards for the duration of its scope.
It makes sure to take the latches in correct order and handles the case where both pages are in the same shard correctly. You quite probably don't want to use this class, which only takes a shard's latch, without acquiring global_latch - which gives no protection from threads which latch only the global_latch exclusively to prevent any activity. You should use it in combination with Global_shared_latch_guard, so that you first obtain an s-latch on the global_latch, or simply use the Shard_latches_guard class which already combines the two for you.
|
explicitprivate |
|
explicit |
locksys::Shard_naked_latches_guard::~Shard_naked_latches_guard | ( | ) |
|
private |
The "smallest" of the two shards' mutexes in the latching order.
|
private |
The "largest" of the two shards' mutexes in the latching order.
|
staticconstexprprivate |
The ordering on shard mutexes used to avoid deadlocks.