MySQL 5.6.14 Source Code Document
|
#include <trx0trx.h>
Public Attributes | |
ulint | n_active_thrs |
trx_que_t | que_state |
lock_t * | wait_lock |
ib_uint64_t | deadlock_mark |
ibool | was_chosen_as_deadlock_victim |
time_t | wait_started |
que_thr_t * | wait_thr |
mem_heap_t * | lock_heap |
trx_locks | |
ib_vector_t * | table_locks |
ibool | cancel |
Latching protocol for trx_lock_t::que_state. trx_lock_t::que_state captures the state of the query thread during the execution of a query. This is different from a transaction state. The query state of a transaction can be updated asynchronously by other threads. The other threads can be system threads, like the timeout monitor thread or user threads executing other queries. Another thing to be mindful of is that there is a delay between when a query thread is put into LOCK_WAIT state and before it actually starts waiting. Between these two events it is possible that the query thread is granted the lock it was waiting for, which implies that the state can be changed asynchronously.
All these operations take place within the context of locking. Therefore state changes within the locking code must acquire both the lock mutex and the trx->mutex when changing trx->lock.que_state to TRX_QUE_LOCK_WAIT or trx->lock.wait_lock to non-NULL but when the lock wait ends it is sufficient to only acquire the trx->mutex. To query the state either of the mutexes is sufficient within the locking code and no mutex is required when the query thread is no longer waiting. The locks and state of an active transaction. Protected by lock_sys->mutex, trx->mutex or both.
ibool trx_lock_t::cancel |
TRUE if the transaction is being rolled back either via deadlock detection or due to lock timeout. The caller has to acquire the trx_t::mutex in order to cancel the locks. In lock_trx_table_locks_remove() we check for this cancel of a transaction's locks and avoid reacquiring the trx mutex to prevent recursive deadlocks. Protected by both the lock sys mutex and the trx_t::mutex.
ib_uint64_t trx_lock_t::deadlock_mark |
mem_heap_t* trx_lock_t::lock_heap |
ulint trx_lock_t::n_active_thrs |
trx_que_t trx_lock_t::que_state |
ib_vector_t* trx_lock_t::table_locks |
trx_lock_t::trx_locks |
lock_t* trx_lock_t::wait_lock |
if trx execution state is TRX_QUE_LOCK_WAIT, this points to the lock request, otherwise this is NULL; set to non-NULL when holding both trx->mutex and lock_sys->mutex; set to NULL when holding lock_sys->mutex; readers should hold lock_sys->mutex, except when they are holding trx->mutex and wait_lock==NULL
time_t trx_lock_t::wait_started |
que_thr_t* trx_lock_t::wait_thr |
ibool trx_lock_t::was_chosen_as_deadlock_victim |