MySQL 9.1.0
Source Code Documentation
ReadView Class Reference

Read view lists the trx ids of those transactions for which a consistent read should not see the modifications to the database. More...

#include <read0types.h>

Classes

class  ids_t
 This is similar to a std::vector but it is not a drop in replacement. More...
 

Public Member Functions

 ReadView ()
 ReadView constructor. More...
 
 ~ReadView ()
 ReadView destructor. More...
 
bool changes_visible (trx_id_t id, const table_name_t &name) const
 Check whether the changes by id are visible. More...
 
bool sees (trx_id_t id) const
 
void close ()
 Mark the view as closed. More...
 
bool is_closed () const
 
void print_limits (FILE *file) const
 Write the limits to the file. More...
 
void reduce_low_limit (trx_id_t trx_no)
 Check and reduce low limit number for read view. More...
 
trx_id_t low_limit_no () const
 
trx_id_t low_limit_id () const
 
bool empty () const
 
trx_id_t view_low_limit_no () const
 
bool le (const ReadView *rhs) const
 

Static Public Member Functions

static void check_trx_id_sanity (trx_id_t id, const table_name_t &name)
 Check whether transaction id is valid. More...
 

Private Member Functions

void copy_trx_ids (const trx_ids_t &trx_ids)
 Copy the transaction ids from the source vector. More...
 
void prepare (trx_id_t id)
 Opens a read view where exactly the transactions serialized before this point in time are seen in the view. More...
 
void copy_prepare (const ReadView &other)
 Copy state from another view. More...
 
void copy_complete ()
 Complete the copy, insert the creator transaction id into the m_trx_ids too and adjust the m_up_limit_id *, if required. More...
 
void creator_trx_id (trx_id_t id)
 Set the creator transaction id, existing id must be 0. More...
 
 ReadView (const ReadView &)
 
ReadViewoperator= (const ReadView &)
 
typedef UT_LIST_NODE_T (ReadView) node_t
 

Private Attributes

trx_id_t m_low_limit_id
 The read should not see any transaction with trx id >= this value. More...
 
trx_id_t m_up_limit_id
 The read should see all trx ids which are strictly smaller (<) than this value. More...
 
trx_id_t m_creator_trx_id
 trx id of creating transaction, set to TRX_ID_MAX for free views. More...
 
ids_t m_ids
 Set of RW transactions that was active when this snapshot was taken. More...
 
trx_id_t m_low_limit_no
 The view does not need to see the undo logs for transactions whose transaction number is strictly smaller (<) than this value: they can be removed in purge if not needed by other views. More...
 
trx_id_t m_view_low_limit_no
 The low limit number up to which read views don't need to access undo log records for MVCC. More...
 
bool m_closed
 AC-NL-RO transaction view that has been "closed". More...
 
byte pad1 [64 - sizeof(node_t)]
 List of read views in trx_sys. More...
 
node_t m_view_list
 

Friends

class MVCC
 

Detailed Description

Read view lists the trx ids of those transactions for which a consistent read should not see the modifications to the database.

Constructor & Destructor Documentation

◆ ReadView() [1/2]

ReadView::ReadView ( )

ReadView constructor.

◆ ~ReadView()

ReadView::~ReadView ( )

ReadView destructor.

◆ ReadView() [2/2]

ReadView::ReadView ( const ReadView )
private

Member Function Documentation

◆ changes_visible()

bool ReadView::changes_visible ( trx_id_t  id,
const table_name_t name 
) const
inline

Check whether the changes by id are visible.

Parameters
[in]idtransaction id to check against the view
[in]nametable name
Returns
whether the view sees the modifications of id.

◆ check_trx_id_sanity()

void ReadView::check_trx_id_sanity ( trx_id_t  id,
const table_name_t name 
)
static

Check whether transaction id is valid.

Parameters
[in]idtransaction id to check
[in]nametable name

◆ close()

void ReadView::close ( void  )
inline

Mark the view as closed.

◆ copy_complete()

void ReadView::copy_complete ( )
inlineprivate

Complete the copy, insert the creator transaction id into the m_trx_ids too and adjust the m_up_limit_id *, if required.

Complete the copy, insert the creator transaction id into the m_ids too and adjust the m_up_limit_id, if required.

◆ copy_prepare()

void ReadView::copy_prepare ( const ReadView other)
inlineprivate

Copy state from another view.

Must call copy_complete() to finish.

Parameters
otherview to copy from

◆ copy_trx_ids()

void ReadView::copy_trx_ids ( const trx_ids_t trx_ids)
inlineprivate

Copy the transaction ids from the source vector.

◆ creator_trx_id()

void ReadView::creator_trx_id ( trx_id_t  id)
inlineprivate

Set the creator transaction id, existing id must be 0.

◆ empty()

bool ReadView::empty ( ) const
inline
Returns
true if there are no transaction ids in the snapshot

◆ is_closed()

bool ReadView::is_closed ( ) const
inline
Returns
true if the view is closed

◆ le()

bool ReadView::le ( const ReadView rhs) const
inline
Parameters
rhsview to compare with
Returns
truen if this view is less than or equal rhs

◆ low_limit_id()

trx_id_t ReadView::low_limit_id ( ) const
inline
Returns
the low limit id

◆ low_limit_no()

trx_id_t ReadView::low_limit_no ( ) const
inline
Returns
the low limit no

◆ operator=()

ReadView & ReadView::operator= ( const ReadView )
private

◆ prepare()

void ReadView::prepare ( trx_id_t  id)
inlineprivate

Opens a read view where exactly the transactions serialized before this point in time are seen in the view.

Parameters
idCreator transaction id

◆ print_limits()

void ReadView::print_limits ( FILE *  file) const
inline

Write the limits to the file.

Parameters
filefile to write to

◆ reduce_low_limit()

void ReadView::reduce_low_limit ( trx_id_t  trx_no)
inline

Check and reduce low limit number for read view.

Used to block purge till GTID is persisted on disk table.

Parameters
[in]trx_notransaction number to check with

◆ sees()

bool ReadView::sees ( trx_id_t  id) const
inline
Parameters
idtransaction to check
Returns
true if view sees transaction id

◆ UT_LIST_NODE_T()

typedef ReadView::UT_LIST_NODE_T ( ReadView  )
private

◆ view_low_limit_no()

trx_id_t ReadView::view_low_limit_no ( ) const
inline
Returns
the view low limit number

Friends And Related Function Documentation

◆ MVCC

friend class MVCC
friend

Member Data Documentation

◆ m_closed

bool ReadView::m_closed
private

AC-NL-RO transaction view that has been "closed".

◆ m_creator_trx_id

trx_id_t ReadView::m_creator_trx_id
private

trx id of creating transaction, set to TRX_ID_MAX for free views.

◆ m_ids

ids_t ReadView::m_ids
private

Set of RW transactions that was active when this snapshot was taken.

◆ m_low_limit_id

trx_id_t ReadView::m_low_limit_id
private

The read should not see any transaction with trx id >= this value.

In other words, this is the "high water mark".

◆ m_low_limit_no

trx_id_t ReadView::m_low_limit_no
private

The view does not need to see the undo logs for transactions whose transaction number is strictly smaller (<) than this value: they can be removed in purge if not needed by other views.

◆ m_up_limit_id

trx_id_t ReadView::m_up_limit_id
private

The read should see all trx ids which are strictly smaller (<) than this value.

In other words, this is the low water mark".

◆ m_view_list

node_t ReadView::m_view_list
private

◆ m_view_low_limit_no

trx_id_t ReadView::m_view_low_limit_no
private

The low limit number up to which read views don't need to access undo log records for MVCC.

This could be higher than m_low_limit_no if purge is blocked for GTID persistence. Currently used for debug variable INNODB_PURGE_VIEW_TRX_ID_AGE.

◆ pad1

byte ReadView::pad1[64 - sizeof(node_t)]
private

List of read views in trx_sys.


The documentation for this class was generated from the following files: