MySQL 9.1.0
Source Code Documentation
undo::Tablespaces Class Reference

List of undo tablespaces, each containing a list of rollback segments. More...

#include <trx0purge.h>

Public Member Functions

 Tablespaces ()
 
 ~Tablespaces ()
 
void init ()
 Initialize. More...
 
void deinit ()
 De-initialize. More...
 
void clear ()
 Clear the contents of the list of Tablespace objects. More...
 
ulint size ()
 Get the number of tablespaces tracked by this object. More...
 
bool empty ()
 See if the list of tablespaces is empty. More...
 
Tablespaceat (size_t pos)
 Get the Tablespace tracked at a position. More...
 
void add (Tablespace &ref_undo_space)
 Add a new undo::Tablespace to the back of the vector. More...
 
void drop (Tablespace *undo_space)
 Drop an existing explicit undo::Tablespace. More...
 
void drop (Tablespace &ref_undo_space)
 Drop an existing explicit undo::Tablespace. More...
 
bool contains (space_id_t num)
 Check if the given space_id is in the vector. More...
 
Tablespacefind (space_id_t num)
 Find the given space_num in the vector. More...
 
Tablespacefind_first_inactive_explicit (size_t *num_active)
 Find the first undo space that is marked inactive explicitly. More...
 
bool own_latch ()
 Determine if this thread owns a lock on m_latch. More...
 
void s_lock ()
 Get a shared lock on m_spaces. More...
 
void s_unlock ()
 Release a shared lock on m_spaces. More...
 
void x_lock ()
 Get an exclusive lock on m_spaces. More...
 
void x_unlock ()
 Release an exclusive lock on m_spaces. More...
 

Public Attributes

Tablespaces_Vector m_spaces
 

Private Types

using Tablespaces_Vector = std::vector< Tablespace *, ut::allocator< Tablespace * > >
 

Private Attributes

rw_lock_tm_latch
 RW lock to protect m_spaces. More...
 

Detailed Description

List of undo tablespaces, each containing a list of rollback segments.

Member Typedef Documentation

◆ Tablespaces_Vector

Constructor & Destructor Documentation

◆ Tablespaces()

undo::Tablespaces::Tablespaces ( )
inline

◆ ~Tablespaces()

undo::Tablespaces::~Tablespaces ( )
inline

Member Function Documentation

◆ add()

void undo::Tablespaces::add ( Tablespace ref_undo_space)

Add a new undo::Tablespace to the back of the vector.

Add a new space_id to the back of the vector.

The vector has been pre-allocated to 128 so read threads will not loose what is pointed to. If tablespace_name and file_name are standard names, they are optional.

Parameters
[in]ref_undo_spaceundo tablespace

◆ at()

Tablespace * undo::Tablespaces::at ( size_t  pos)
inline

Get the Tablespace tracked at a position.

◆ clear()

void undo::Tablespaces::clear ( )
inline

Clear the contents of the list of Tablespace objects.

This does not deallocate any memory.

◆ contains()

bool undo::Tablespaces::contains ( space_id_t  num)
inline

Check if the given space_id is in the vector.

Parameters
[in]numundo tablespace number
Returns
true if space_id is found, else false

◆ deinit()

void undo::Tablespaces::deinit ( void  )

De-initialize.

De-initialize the undo::Tablespaces object.

◆ drop() [1/2]

void undo::Tablespaces::drop ( Tablespace ref_undo_space)

Drop an existing explicit undo::Tablespace.

Parameters
[in]ref_undo_spacereference to undo space

◆ drop() [2/2]

void undo::Tablespaces::drop ( Tablespace undo_space)

Drop an existing explicit undo::Tablespace.

Parameters
[in]undo_spacepointer to undo space

◆ empty()

bool undo::Tablespaces::empty ( )
inline

See if the list of tablespaces is empty.

◆ find()

Tablespace * undo::Tablespaces::find ( space_id_t  num)
inline

Find the given space_num in the vector.

Parameters
[in]numundo tablespace number
Returns
pointer to an undo::Tablespace struct

◆ find_first_inactive_explicit()

Tablespace * undo::Tablespaces::find_first_inactive_explicit ( size_t *  num_active)
inline

Find the first undo space that is marked inactive explicitly.

Parameters
[in,out]num_activeIf there are no inactive_explicit spaces found, this will contain the number of active spaces found.
Returns
pointer to an undo::Tablespace struct

◆ init()

void undo::Tablespaces::init ( void  )

Initialize.

Initialize the undo::Tablespaces object.

Fix the size of the vector so that it will not do allocations for inserts. This way the contents can be read without using a latch.

◆ own_latch()

bool undo::Tablespaces::own_latch ( )
inline

Determine if this thread owns a lock on m_latch.

◆ s_lock()

void undo::Tablespaces::s_lock ( )
inline

Get a shared lock on m_spaces.

◆ s_unlock()

void undo::Tablespaces::s_unlock ( )
inline

Release a shared lock on m_spaces.

◆ size()

ulint undo::Tablespaces::size ( )
inline

Get the number of tablespaces tracked by this object.

◆ x_lock()

void undo::Tablespaces::x_lock ( )
inline

Get an exclusive lock on m_spaces.

◆ x_unlock()

void undo::Tablespaces::x_unlock ( )
inline

Release an exclusive lock on m_spaces.

Member Data Documentation

◆ m_latch

rw_lock_t* undo::Tablespaces::m_latch
private

RW lock to protect m_spaces.

x for adding elements, s for scanning, size() etc.

◆ m_spaces

Tablespaces_Vector undo::Tablespaces::m_spaces

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