MySQL 9.1.0
Source Code Documentation
|
Used to represent locks requests uniquely over time. More...
#include <lock0types.h>
Public Member Functions | |
lock_guid_t ()=default | |
Initializes the lock_guid_t object to a value which doesn't match any real lock. More... | |
lock_guid_t (const lock_t &lock) | |
Initializes lock_guid_t with data uniquely identifying the lock request(s) represented by lock_t object. More... | |
bool | operator== (const lock_guid_t &rhs) const |
Checks if two guids represent the same lock (conceptually): they represent the same lock_t struct in memory and it was not reused. More... | |
bool | operator!= (const lock_guid_t &rhs) const |
Checks if two guids represent two different locks (conceptually): they represent two different lock_t structs in memory or struct was reused. More... | |
operator bool () const | |
Checks if the instance is non-empty, i.e. More... | |
Public Attributes | |
trx_guid_t | m_trx_guid {} |
The guid of lock->trx. More... | |
uint64_t | m_immutable_id {} |
Id of the lock_t struct such that it does not change over time, and two different lock_t structs never have the same id. More... | |
Used to represent locks requests uniquely over time.
Please note that in case of LOCK_REC there might be actually multiple "sub-requests" for many different heap_no associated with the same lock_t object which we ignore here and use same guid for all of them. Also, the lock mode and status and other properties of the lock can change over time and/or represent more than one actual request. This is also ignored here. What we try to achieve is some way to identify lock_t struct such that: (1) we can serialize and deserialize it (2) we don't have to be afraid of dangling pointers (3) if the same lock_t gets deallocated and then allocated again, or otherwise reused by a different transaction, we will have a different guid for it. Note, that a single transaction never dealloactes a lock_t and allocates it again, as all deallocations happen during commit (lock_trx_release_locks).
|
default |
Initializes the lock_guid_t object to a value which doesn't match any real lock.
lock_guid_t::lock_guid_t | ( | const lock_t & | lock | ) |
Initializes lock_guid_t with data uniquely identifying the lock request(s) represented by lock_t object.
[in] | lock | the object representing the lock request(s) |
|
inline |
Checks if the instance is non-empty, i.e.
was not default-constructed, but rather initialized to correspond to a real lock_t.
|
inline |
Checks if two guids represent two different locks (conceptually): they represent two different lock_t structs in memory or struct was reused.
[in] | rhs | another guid to compare against |
|
inline |
Checks if two guids represent the same lock (conceptually): they represent the same lock_t struct in memory and it was not reused.
[in] | rhs | another guid to compare against |
uint64_t lock_guid_t::m_immutable_id {} |
Id of the lock_t struct such that it does not change over time, and two different lock_t structs never have the same id.
However it may happen that two "different" locks at different points in time actually reuse the same lock_t struct and thus have the same immutable id - this is why we also store the transaction's guid
trx_guid_t lock_guid_t::m_trx_guid {} |
The guid of lock->trx.
Used to identify ABA problems when the same lock_t struct gets reused by a new transaction.