MySQL 8.3.0
Source Code Documentation
Flush_observer Class Reference

We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load.cc).Since we disable redo logging during a index build, we need to make sure that all dirty pages modified by the index build are flushed to disk before any redo logged operations go to the index. More...

#include <buf0flu.h>

Public Member Functions

 Flush_observer (space_id_t space_id, trx_t *trx, Alter_stage *stage) noexcept
 Constructor. More...
 
 ~Flush_observer () noexcept
 Destructor. More...
 
std::ostream & print (std::ostream &out) const
 Print information about the current object. More...
 
bool is_complete (size_t instance_no)
 Check pages have been flushed and removed from the flush list in a buffer pool instance. More...
 
void interrupted ()
 Interrupt observer not to wait. More...
 
bool check_interrupted ()
 Check whether trx is interrupted. More...
 
void flush ()
 Flush dirty pages. More...
 
void notify_flush (buf_pool_t *buf_pool, buf_page_t *bpage)
 Notify observer of flushing a page. More...
 
void notify_remove (buf_pool_t *buf_pool, buf_page_t *bpage)
 Notify observer of removing a page from flush list. More...
 

Private Types

using Counter = std::atomic_int
 
using Counters = std::vector< Counter, ut::allocator< Counter > >
 

Private Member Functions

bool validate () const noexcept
 

Private Attributes

space_id_t m_space_id {}
 Tablespace ID. More...
 
trx_tm_trx {}
 Trx instance. More...
 
Alter_stagem_stage {}
 Performance schema accounting object, used by ALTER TABLE. More...
 
Counters m_flushed {}
 Flush request sent, per buffer pool. More...
 
Counters m_removed {}
 Flush request finished, per buffer pool. More...
 
Counter m_n_ref_count {}
 Number of pages using this instance. More...
 
bool m_interrupted {}
 True if the operation was interrupted. More...
 

Detailed Description

We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load.cc).Since we disable redo logging during a index build, we need to make sure that all dirty pages modified by the index build are flushed to disk before any redo logged operations go to the index.

Member Typedef Documentation

◆ Counter

using Flush_observer::Counter = std::atomic_int
private

◆ Counters

using Flush_observer::Counters = std::vector<Counter, ut::allocator<Counter> >
private

Constructor & Destructor Documentation

◆ Flush_observer()

Flush_observer::Flush_observer ( space_id_t  space_id,
trx_t trx,
Alter_stage stage 
)
noexcept

Constructor.

Parameters
[in]space_idtable space id
[in]trxtrx instance
[in,out]stagePFS progress monitoring instance, it's used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages() for accounting.

◆ ~Flush_observer()

Flush_observer::~Flush_observer ( )
noexcept

Destructor.

Member Function Documentation

◆ check_interrupted()

bool Flush_observer::check_interrupted ( )

Check whether trx is interrupted.

Returns
true if trx is interrupted

◆ flush()

void Flush_observer::flush ( )

Flush dirty pages.

◆ interrupted()

void Flush_observer::interrupted ( )
inline

Interrupt observer not to wait.

◆ is_complete()

bool Flush_observer::is_complete ( size_t  instance_no)
inline

Check pages have been flushed and removed from the flush list in a buffer pool instance.

Parameters
[in]instance_nobuffer pool instance no
Returns
true if the pages were removed from the flush list

◆ notify_flush()

void Flush_observer::notify_flush ( buf_pool_t buf_pool,
buf_page_t bpage 
)

Notify observer of flushing a page.

Parameters
[in]buf_poolbuffer pool instance
[in]bpagebuffer page to flush

◆ notify_remove()

void Flush_observer::notify_remove ( buf_pool_t buf_pool,
buf_page_t bpage 
)

Notify observer of removing a page from flush list.

Parameters
[in]buf_poolbuffer pool instance
[in]bpagebuffer page flushed

◆ print()

std::ostream & Flush_observer::print ( std::ostream &  out) const

Print information about the current object.

Parameters
[in,out]outoutput stream to be used.
Returns
the output stream.

◆ validate()

bool Flush_observer::validate ( ) const
privatenoexcept

Member Data Documentation

◆ m_flushed

Counters Flush_observer::m_flushed {}
private

Flush request sent, per buffer pool.

◆ m_interrupted

bool Flush_observer::m_interrupted {}
private

True if the operation was interrupted.

◆ m_n_ref_count

Counter Flush_observer::m_n_ref_count {}
private

Number of pages using this instance.

◆ m_removed

Counters Flush_observer::m_removed {}
private

Flush request finished, per buffer pool.

◆ m_space_id

space_id_t Flush_observer::m_space_id {}
private

Tablespace ID.

◆ m_stage

Alter_stage* Flush_observer::m_stage {}
private

Performance schema accounting object, used by ALTER TABLE.

If not nullptr, then stage->begin_phase_flush() will be called initially, specifying the number of pages to be attempted to be flushed and subsequently, stage->inc() will be called for each page we attempt to flush.

◆ m_trx

trx_t* Flush_observer::m_trx {}
private

Trx instance.


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