MySQL 9.1.0
Source Code Documentation
undo::Truncate Class Reference

Track an UNDO tablespace marked for truncate. More...

#include <trx0purge.h>

Public Member Functions

 Truncate ()
 Constructor. More...
 
 ~Truncate ()=default
 Destructor. More...
 
bool is_marked () const
 Is tablespace selected for truncate. More...
 
void set_marked_space_empty ()
 Mark the undo tablespace selected for truncate as empty so that it will be truncated next. More...
 
bool is_marked_space_empty () const
 Is the tablespace selected for truncate empty of undo logs yet? More...
 
void mark (Tablespace *undo_space)
 Mark the tablespace for truncate. More...
 
space_id_t get_marked_space_num () const
 Get the ID of the tablespace marked for truncate. More...
 
void reset ()
 Reset for next rseg truncate. More...
 
space_id_t get_scan_space_num () const
 Get the undo tablespace number to start a scan. More...
 
space_id_t increment_scan () const
 Increment the scanning position in a round-robin fashion. More...
 
bool is_equal (space_id_t space_id) const
 Check if the given space id is equal to the space ID that is marked for truncation. More...
 
int64_t check_timer () const
 
void reset_timer ()
 Reset the timer. More...
 

Private Attributes

space_id_t m_space_id_marked
 UNDO space ID that is marked for truncate. More...
 
bool m_marked_space_is_empty
 This is true if the marked space is empty of undo logs and ready to truncate. More...
 
ib::Timer m_timer
 Elapsed time since last truncate check. More...
 

Static Private Attributes

static size_t s_scan_pos
 Start scanning for UNDO tablespace from this vector position. More...
 

Detailed Description

Track an UNDO tablespace marked for truncate.

Constructor & Destructor Documentation

◆ Truncate()

undo::Truncate::Truncate ( )
inline

Constructor.

◆ ~Truncate()

undo::Truncate::~Truncate ( )
default

Destructor.

Member Function Documentation

◆ check_timer()

int64_t undo::Truncate::check_timer ( ) const
inline
Returns
the number of milliseconds since last reset.

◆ get_marked_space_num()

space_id_t undo::Truncate::get_marked_space_num ( ) const
inline

Get the ID of the tablespace marked for truncate.

Returns
tablespace ID marked for truncate.

◆ get_scan_space_num()

space_id_t undo::Truncate::get_scan_space_num ( ) const
inline

Get the undo tablespace number to start a scan.

Re-adjust in case the spaces::size() went down.

Returns
undo space_num to start scanning.

◆ increment_scan()

space_id_t undo::Truncate::increment_scan ( ) const
inline

Increment the scanning position in a round-robin fashion.

Returns
undo space_num at incremented scanning position.

Round-robin way of selecting an undo tablespace for the truncate operation. Once we reach the end of the list of known undo tablespace IDs, move back to the first undo tablespace ID. This will scan active as well as inactive undo tablespaces.

◆ is_equal()

bool undo::Truncate::is_equal ( space_id_t  space_id) const
inline

Check if the given space id is equal to the space ID that is marked for truncation.

Returns
true if they are equal, false otherwise.

◆ is_marked()

bool undo::Truncate::is_marked ( ) const
inline

Is tablespace selected for truncate.

Returns
true if undo tablespace is marked for truncate

◆ is_marked_space_empty()

bool undo::Truncate::is_marked_space_empty ( ) const
inline

Is the tablespace selected for truncate empty of undo logs yet?

Returns
true if the marked undo tablespace has no more undo logs

◆ mark()

void undo::Truncate::mark ( Tablespace undo_space)

Mark the tablespace for truncate.

Parameters
[in]undo_spaceundo tablespace to truncate.

◆ reset()

void undo::Truncate::reset ( void  )
inline

Reset for next rseg truncate.

◆ reset_timer()

void undo::Truncate::reset_timer ( )
inline

Reset the timer.

◆ set_marked_space_empty()

void undo::Truncate::set_marked_space_empty ( )
inline

Mark the undo tablespace selected for truncate as empty so that it will be truncated next.

Member Data Documentation

◆ m_marked_space_is_empty

bool undo::Truncate::m_marked_space_is_empty
private

This is true if the marked space is empty of undo logs and ready to truncate.

We leave the rsegs object 'inactive' until after it is truncated and rebuilt. This allow the code to do the check for undo logs only once.

◆ m_space_id_marked

space_id_t undo::Truncate::m_space_id_marked
private

UNDO space ID that is marked for truncate.

◆ m_timer

ib::Timer undo::Truncate::m_timer
private

Elapsed time since last truncate check.

◆ s_scan_pos

size_t undo::Truncate::s_scan_pos
staticprivate

Start scanning for UNDO tablespace from this vector position.

This is to avoid bias selection of one tablespace always.


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