MySQL  8.0.23
Source Code Documentation
HazardPointer Class Referenceabstract

A "Hazard Pointer" class used to iterate over page lists inside the buffer pool. More...

#include <buf0buf.h>

Inheritance diagram for HazardPointer:
FlushHp LRUHp LRUItr

Public Member Functions

 HazardPointer (const buf_pool_t *buf_pool, const ib_mutex_t *mutex)
 Constructor. More...
 
virtual ~HazardPointer ()
 Destructor. More...
 
buf_page_tget () const
 Get current value. More...
 
void set (buf_page_t *bpage)
 Set current value. More...
 
bool is_hp (const buf_page_t *bpage)
 Checks if a bpage is the hp. More...
 
virtual void adjust (const buf_page_t *bpage)=0
 Adjust the value of hp. More...
 
void move (const buf_page_t *bpage, buf_page_t *dpage)
 Adjust the value of hp for moving. More...
 

Protected Member Functions

 HazardPointer (const HazardPointer &)
 Disable copying. More...
 
HazardPointeroperator= (const HazardPointer &)
 

Protected Attributes

const buf_pool_tm_buf_pool
 Buffer pool instance. More...
 
const ib_mutex_t * m_mutex
 mutex that protects access to the m_hp. More...
 
buf_page_tm_hp
 hazard pointer. More...
 

Detailed Description

A "Hazard Pointer" class used to iterate over page lists inside the buffer pool.

A hazard pointer is a buf_page_t pointer which we intend to iterate over next and we want it remain valid even after we release the buffer pool mutex.

Constructor & Destructor Documentation

◆ HazardPointer() [1/2]

HazardPointer::HazardPointer ( const buf_pool_t buf_pool,
const ib_mutex_t *  mutex 
)
inline

Constructor.

Parameters
buf_poolbuffer pool instance
mutexmutex that is protecting the hp.

◆ ~HazardPointer()

virtual HazardPointer::~HazardPointer ( )
inlinevirtual

Destructor.

◆ HazardPointer() [2/2]

HazardPointer::HazardPointer ( const HazardPointer )
protected

Disable copying.

Member Function Documentation

◆ adjust()

virtual void HazardPointer::adjust ( const buf_page_t bpage)
pure virtual

Adjust the value of hp.

This happens when some other thread working on the same list attempts to remove the hp from the list. Must be implemented by the derived classes.

Parameters
bpagebuffer block to be compared

Implemented in LRUHp, and FlushHp.

◆ get()

buf_page_t* HazardPointer::get ( ) const
inline

Get current value.

◆ is_hp()

bool HazardPointer::is_hp ( const buf_page_t bpage)

Checks if a bpage is the hp.

Parameters
bpagebuffer block to be compared
Returns
true if it is hp

◆ move()

void HazardPointer::move ( const buf_page_t bpage,
buf_page_t dpage 
)

Adjust the value of hp for moving.

This happens when some other thread working on the same list attempts to relocate the hp of the page.

Parameters
bpagebuffer block to be compared
dpagebuffer block to be moved to

◆ operator=()

HazardPointer& HazardPointer::operator= ( const HazardPointer )
protected

◆ set()

void HazardPointer::set ( buf_page_t bpage)

Set current value.

Parameters
bpagebuffer block to be set as hp

Member Data Documentation

◆ m_buf_pool

const buf_pool_t* HazardPointer::m_buf_pool
protected

Buffer pool instance.

◆ m_hp

buf_page_t* HazardPointer::m_hp
protected

hazard pointer.

◆ m_mutex

const ib_mutex_t* HazardPointer::m_mutex
protected

mutex that protects access to the m_hp.


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