MySQL 8.4.0
Source Code Documentation
Rsegs Class Reference

This is a wrapper for a std::vector of trx_rseg_t object pointers. More...

#include <trx0types.h>

Public Member Functions

 Rsegs ()
 Default constructor. More...
 
 ~Rsegs ()
 
void init ()
 Initialize. More...
 
void deinit ()
 De-initialize. More...
 
void clear ()
 Clear the vector of cached rollback segments leaving the reserved space allocated. More...
 
void push_back (trx_rseg_t *rseg)
 Add rollback segment. More...
 
ulint size ()
 Number of registered rsegs. More...
 
Rseg_Iterator begin ()
 beginning iterator More...
 
Rseg_Iterator end ()
 ending iterator More...
 
trx_rseg_tat (ulint slot)
 Find the rseg at the given slot in this vector. More...
 
trx_rseg_tfind (ulint rseg_id)
 Find an rseg in the std::vector that uses the rseg_id given. More...
 
void sort ()
 Sort the vector on trx_rseg_t::id. More...
 
void s_lock ()
 Acquire the shared lock on m_rsegs. More...
 
void s_unlock ()
 Release the shared lock on m_rsegs. More...
 
void x_lock ()
 Acquire the exclusive lock on m_rsegs. More...
 
void x_unlock ()
 Release the exclusive lock on m_rsegs. More...
 
bool is_active ()
 Return whether the undo tablespace is active. More...
 
bool is_inactive_implicit ()
 Return whether the undo tablespace is inactive due to implicit selection by the purge thread. More...
 
bool is_inactive_explicit ()
 Return whether the undo tablespace was made inactive by ALTER TABLESPACE. More...
 
bool is_empty ()
 Return whether the undo tablespace is empty and ready to be dropped. More...
 
bool is_init ()
 Return whether the undo tablespace is being initialized. More...
 
void set_active ()
 Set the state of the rollback segments in this undo tablespace to ACTIVE for use by new transactions. More...
 
void set_inactive_implicit ()
 Set the state of the rollback segments in this undo tablespace to inactive_implicit. More...
 
void set_inactive_explicit ()
 Make the undo tablespace inactive so that it will not be used for new transactions. More...
 
void set_empty ()
 Set the state of the undo tablespace to empty so that it can be dropped. More...
 

Public Attributes

Rsegs_Vector m_rsegs
 std::vector of rollback segments More...
 

Private Types

enum  undo_space_states {
  INIT , ACTIVE , INACTIVE_IMPLICIT , INACTIVE_EXPLICIT ,
  EMPTY
}
 

Private Attributes

rw_lock_tm_latch
 RW lock to protect m_rsegs vector, m_active, and each trx_rseg_t::trx_ref_count within it. More...
 
undo_space_states m_state
 The current state of this undo tablespace. More...
 

Detailed Description

This is a wrapper for a std::vector of trx_rseg_t object pointers.

Member Enumeration Documentation

◆ undo_space_states

Enumerator
INIT 
ACTIVE 
INACTIVE_IMPLICIT 
INACTIVE_EXPLICIT 
EMPTY 

Constructor & Destructor Documentation

◆ Rsegs()

Rsegs::Rsegs ( )
inline

Default constructor.

◆ ~Rsegs()

Rsegs::~Rsegs ( )
inline

Member Function Documentation

◆ at()

trx_rseg_t * Rsegs::at ( ulint  slot)
inline

Find the rseg at the given slot in this vector.

Parameters
[in]slota slot within the vector.
Returns
an iterator to the end

◆ begin()

Rseg_Iterator Rsegs::begin ( void  )
inline

beginning iterator

Returns
an iterator to the first element

◆ clear()

void Rsegs::clear ( )

Clear the vector of cached rollback segments leaving the reserved space allocated.

◆ deinit()

void Rsegs::deinit ( void  )

De-initialize.

◆ end()

Rseg_Iterator Rsegs::end ( void  )
inline

ending iterator

Returns
an iterator to the end

◆ find()

trx_rseg_t * Rsegs::find ( ulint  rseg_id)

Find an rseg in the std::vector that uses the rseg_id given.

Parameters
[in]rseg_idA slot in a durable array such as the TRX_SYS page or RSEG_ARRAY page.
Returns
a pointer to an trx_rseg_t that uses the rseg_id.

◆ init()

void Rsegs::init ( void  )

Initialize.

◆ is_active()

bool Rsegs::is_active ( )
inline

Return whether the undo tablespace is active.

Returns
true if active

◆ is_empty()

bool Rsegs::is_empty ( void  )
inline

Return whether the undo tablespace is empty and ready to be dropped.

Returns
true if empty

◆ is_inactive_explicit()

bool Rsegs::is_inactive_explicit ( )
inline

Return whether the undo tablespace was made inactive by ALTER TABLESPACE.

Returns
true if altered

◆ is_inactive_implicit()

bool Rsegs::is_inactive_implicit ( )
inline

Return whether the undo tablespace is inactive due to implicit selection by the purge thread.

Returns
true if marked for truncation by the purge thread

◆ is_init()

bool Rsegs::is_init ( )
inline

Return whether the undo tablespace is being initialized.

Returns
true if empty

◆ push_back()

void Rsegs::push_back ( trx_rseg_t rseg)
inline

Add rollback segment.

Parameters
[in]rsegrollback segment to add.

◆ s_lock()

void Rsegs::s_lock ( )
inline

Acquire the shared lock on m_rsegs.

◆ s_unlock()

void Rsegs::s_unlock ( )
inline

Release the shared lock on m_rsegs.

◆ set_active()

void Rsegs::set_active ( )
inline

Set the state of the rollback segments in this undo tablespace to ACTIVE for use by new transactions.

◆ set_empty()

void Rsegs::set_empty ( )
inline

Set the state of the undo tablespace to empty so that it can be dropped.

◆ set_inactive_explicit()

void Rsegs::set_inactive_explicit ( )
inline

Make the undo tablespace inactive so that it will not be used for new transactions.

The purge thread will clear out all the undo logs, truncate it, and then mark it empty.

◆ set_inactive_implicit()

void Rsegs::set_inactive_implicit ( )
inline

Set the state of the rollback segments in this undo tablespace to inactive_implicit.

This means that it will be truncated and then made active again by the purge thread. It will not be used for new transactions until it becomes active again.

◆ size()

ulint Rsegs::size ( )
inline

Number of registered rsegs.

Returns
size of rseg list.

◆ sort()

void Rsegs::sort ( )
inline

Sort the vector on trx_rseg_t::id.

◆ x_lock()

void Rsegs::x_lock ( )
inline

Acquire the exclusive lock on m_rsegs.

◆ x_unlock()

void Rsegs::x_unlock ( )
inline

Release the exclusive lock on m_rsegs.

Member Data Documentation

◆ m_latch

rw_lock_t* Rsegs::m_latch
private

RW lock to protect m_rsegs vector, m_active, and each trx_rseg_t::trx_ref_count within it.

m_rsegs: x for adding elements, s for scanning, size etc. m_active: x for modification, s for read each trx_rseg_t::trx_ref_count within m_rsegs s and atomic increment for modification, x for read

◆ m_rsegs

Rsegs_Vector Rsegs::m_rsegs

std::vector of rollback segments

◆ m_state

undo_space_states Rsegs::m_state
private

The current state of this undo tablespace.


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