MySQL 8.4.2
Source Code Documentation
|
The MVCC read view manager. More...
#include <read0read.h>
Public Member Functions | |
MVCC (ulint size) | |
Constructor. More... | |
~MVCC () | |
Destructor. More... | |
void | view_open (ReadView *&view, trx_t *trx) |
Allocate and create a view. More... | |
void | view_close (ReadView *&view, bool own_mutex) |
Close a view created by the above function. More... | |
void | clone_oldest_view (ReadView *view) |
Clones the oldest view and stores it in view. More... | |
ulint | size () const |
Static Public Member Functions | |
static bool | is_view_active (ReadView *view) |
static void | set_view_creator_trx_id (ReadView *view, trx_id_t id) |
Set the view creator transaction id. More... | |
Private Member Functions | |
bool | validate () const |
Validates a read view list. More... | |
ReadView * | get_view () |
Find a free view from the active list, if none found then allocate a new view. More... | |
ReadView * | get_oldest_view () const |
Get the oldest view in the system. More... | |
MVCC (const MVCC &) | |
MVCC & | operator= (const MVCC &) |
typedef | UT_LIST_BASE_NODE_T (ReadView, m_view_list) view_list_t |
Private Attributes | |
view_list_t | m_free |
Free views ready for reuse. More... | |
view_list_t | m_views |
Active and closed views, the closed views will have the creator trx id set to TRX_ID_MAX. More... | |
The MVCC read view manager.
|
explicit |
Constructor.
size | Number of views to pre-allocate |
MVCC::~MVCC | ( | ) |
Destructor.
Free all the views in the m_free list
|
private |
void MVCC::clone_oldest_view | ( | ReadView * | view | ) |
Clones the oldest view and stores it in view.
No need to call view_close(). The caller owns the view that is passed in. It will also move the closed views from the m_views list to the m_free list. This function is called by Purge to determine whether it should purge the delete marked record or not.
view | Preallocated view, owned by the caller |
|
inlineprivate |
Get the oldest view in the system.
Get the oldest (active) view in the system.
It will also move the delete marked read views from the views list to the freed list.
|
inlineprivate |
Find a free view from the active list, if none found then allocate a new view.
This function will also attempt to move delete marked views from the active list to the freed list.
|
inlinestatic |
Set the view creator transaction id.
Note: This should be set only for views created by RW transactions.
view | Set the creator trx id for this view |
id | Transaction id to set |
ulint MVCC::size | ( | ) | const |
|
private |
|
private |
Validates a read view list.
void MVCC::view_close | ( | ReadView *& | view, |
bool | own_mutex | ||
) |
Close a view created by the above function.
view | view allocated by trx_open. |
own_mutex | true if caller owns trx_sys_t::mutex |
Allocate and create a view.
view | View owned by this class created for the caller. Must be freed by calling view_close() |
trx | Transaction instance of caller |
If no new RW transaction has been started since the last view was created then reuse the the existing view.
|
private |
Free views ready for reuse.
|
private |
Active and closed views, the closed views will have the creator trx id set to TRX_ID_MAX.