|
std::ostream & | operator<< (std::ostream &out, const lock_table_t &lock) |
| The global output operator is overloaded to conveniently print the lock_table_t object into the given output stream. More...
|
|
std::ostream & | operator<< (std::ostream &out, const lock_rec_t &lock) |
|
static bool | lock_mode_is_next_key_lock (ulint mode) |
| Checks if the mode is LOCK_S or LOCK_X (possibly ORed with LOCK_WAIT or LOCK_REC) which means the lock is a Next Key Lock, a.k.a. More...
|
|
static bool | lock_rec_get_nth_bit (const lock_t *lock, ulint i) |
| Gets the nth bit of a record lock. More...
|
|
std::ostream & | operator<< (std::ostream &out, const lock_t &lock) |
|
static uint32_t | lock_get_type_low (const lock_t *lock) |
| Gets the type of a lock. More...
|
|
void | lock_cancel_waiting_and_release (trx_t *trx) |
| Cancels a waiting lock request and releases possible other transactions waiting behind it. More...
|
|
void | lock_reset_wait_and_release_thread_if_suspended (lock_t *lock) |
| This function is a wrapper around several functions which need to be called in particular order to wake up a transaction waiting for a lock. More...
|
|
static trx_id_t | lock_clust_rec_some_has_impl (const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
| Checks if some transaction has an implicit x-lock on a record in a clustered index. More...
|
|
static uint32_t | lock_rec_get_n_bits (const lock_t *lock) |
| Gets the number of bits in a record lock bitmap. More...
|
|
static void | lock_rec_set_nth_bit (lock_t *lock, ulint i) |
| Sets the nth bit of a record lock to true. More...
|
|
static enum lock_mode | lock_get_mode (const lock_t *lock) |
| Gets the mode of a lock. More...
|
|
static ulint | lock_mode_compatible (enum lock_mode mode1, enum lock_mode mode2) |
| Calculates if lock mode 1 is compatible with lock mode 2. More...
|
|
static bool | lock_mode_stronger_or_eq (enum lock_mode mode1, enum lock_mode mode2) |
| Calculates if lock mode 1 is stronger or equal to lock mode 2. More...
|
|
static ulint | lock_get_wait (const lock_t *lock) |
| Gets the wait flag of a lock. More...
|
|
static bool | lock_table_has (const trx_t *trx, const dict_table_t *table, enum lock_mode mode) |
| Checks if a transaction has the specified table lock, or stronger. More...
|
|
void | lock_notify_about_deadlock (const ut::vector< const trx_t * > &trxs_on_cycle, const trx_t *victim_trx) |
| Handles writing the information about found deadlock to the log files and caches it for future lock_latest_err_file() calls (for example used by SHOW ENGINE INNODB STATUS) More...
|
|
template<typename F > |
auto | locksys::latch_peeked_shard_and_do (const lock_t *peeked_lock, F &&f) |
| Temporarily releases trx->mutex, latches the lock-sys shard containing peeked_lock and latches trx->mutex again and calls f under protection of both latches. More...
|
|
template<typename F > |
void | locksys::run_if_waiting (const TrxVersion trx_version, F &&f) |
| Given a pointer to trx (which the caller guarantees will not be freed) and the expected value of trx->version, will call the provided function f, only if the trx is still in expected version and waiting for a lock, within a critical section which holds latches on the trx, and the shard containing the waiting lock. More...
|
|
Lock module internal structures and methods.
Created July 12, 2007 Vasil Dimov
void lock_reset_wait_and_release_thread_if_suspended |
( |
lock_t * |
lock | ) |
|
This function is a wrapper around several functions which need to be called in particular order to wake up a transaction waiting for a lock.
You should not call lock_wait_release_thread_if_suspended(thr) directly, but rather use this wrapper, as this makes it much easier to reason about all possible states in which lock, trx, and thr can be. It makes sure that trx is woken up exactly once, and only if it already went to sleep.
- Parameters
-
[in,out] | lock | The lock for which lock->trx is waiting |
Checks if a transaction has the specified table lock, or stronger.
This function should only be called by the thread that owns the transaction. This function acquires trx->mutex which protects trx->lock.trx_locks, but you should understand that this only makes it easier to argue against races at the level of access to the data structure, yet does not buy us any protection at the higher level of making actual decisions based on the result of this call - it may happen that another thread is removing a table lock, and even though lock_table_has returned true to the caller, the lock is no longer in possession of trx once the caller gets to evaluate if/else condition based on the result. Therefore it is up to caller to make sure that the context of the call to this function and making any decisions based on the result is protected from any concurrent modifications. This in turn makes the whole trx_mutex_enter/exit a bit redundant, but it does not affect performance yet makes the reasoning about data structure a bit easier and protects trx->lock.trx_locks data structure from corruption in case our high level reasoning about absence of parallel modifications turns out wrong.
- Parameters
-
[in] | trx | transaction |
[in] | table | table |
[in] | mode | lock mode |
- Returns
- lock or NULL