MySQL 9.1.0
Source Code Documentation
|
A 'lock' protecting performance schema internal buffers. More...
#include <pfs_lock.h>
Public Member Functions | |
uint32 | copy_version_state () |
bool | is_free () |
Returns true if the record is free. More... | |
bool | is_populated () |
Returns true if the record contains values that can be read. More... | |
bool | free_to_dirty (pfs_dirty_state *copy_ptr) |
Execute a free to dirty transition. More... | |
void | allocated_to_dirty (pfs_dirty_state *copy_ptr) |
Execute an allocated to dirty transition. More... | |
void | dirty_to_allocated (const pfs_dirty_state *copy) |
Execute a dirty to allocated transition. More... | |
void | set_allocated () |
Initialize a lock to allocated. More... | |
void | set_dirty (pfs_dirty_state *copy_ptr) |
Initialize a lock to dirty. More... | |
void | dirty_to_free (const pfs_dirty_state *copy) |
Execute a dirty to free transition. More... | |
void | allocated_to_free () |
Execute an allocated to free transition. More... | |
void | begin_optimistic_lock (pfs_optimistic_state *copy) |
Start an optimistic read operation. More... | |
bool | end_optimistic_lock (const pfs_optimistic_state *copy) |
End an optimistic read operation. More... | |
uint32 | get_version () |
Public Attributes | |
std::atomic< uint32 > | m_version_state |
The record internal version and state. More... | |
A 'lock' protecting performance schema internal buffers.
This lock is used to mark the state of a record. Access to the record is not enforced here, it's up to the readers and writers to look at the record state before making an actual read or write operation.
The following state diagram shows the general states maintained by the lock.
An internal version counter is also incremented, to detect each modification done to a record.
The following diagram represent a fragment of all the states reached, for an object creation, modification and destruction.
|
inline |
Execute an allocated to dirty transition.
This transition should be executed by the writer that owns the record, before the record is modified.
|
inline |
Execute an allocated to free transition.
This transition should be executed by the writer that owns the record.
|
inline |
Start an optimistic read operation.
[out] | copy | Saved lock state |
|
inline |
|
inline |
Execute a dirty to allocated transition.
This transition should be executed by the writer that owns the record, after the record is in a state ready to be read.
|
inline |
Execute a dirty to free transition.
This transition should be executed by the writer that owns the record.
|
inline |
End an optimistic read operation.
copy | Saved lock state |
|
inline |
Execute a free to dirty transition.
This transition is safe to execute concurrently by multiple writers. Only one writer will succeed to acquire the record.
|
inline |
|
inline |
Returns true if the record is free.
|
inline |
Returns true if the record contains values that can be read.
|
inline |
Initialize a lock to allocated.
This transition should be executed by the writer that owns the record and the lock, after the record is in a state ready to be read.
|
inline |
Initialize a lock to dirty.
std::atomic<uint32> pfs_lock::m_version_state |
The record internal version and state.