MySQL  8.0.23
Source Code Documentation
FlushObserver Class Reference

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

#include <buf0flu.h>

Public Member Functions

 FlushObserver (space_id_t space_id, trx_t *trx, ut_stage_alter_t *stage) noexcept
 Constructor. More...
 
 ~FlushObserver () noexcept
 Destructor. 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 Attributes

space_id_t m_space_id {}
 Tablespace ID. More...
 
trx_tm_trx {}
 Trx instance. More...
 
ut_stage_alter_tm_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 FlushObserver to track flushing of non-redo logged pages in bulk create index(BtrBulk.cc).Since we disable redo logging during a index build, we need to make sure that all dirty pages modifed by the index build are flushed to disk before any redo logged operations go to the index.

Member Typedef Documentation

◆ Counter

using FlushObserver::Counter = std::atomic_int
private

◆ Counters

using FlushObserver::Counters = std::vector<Counter, ut_allocator<Counter> >
private

Constructor & Destructor Documentation

◆ FlushObserver()

FlushObserver::FlushObserver ( space_id_t  space_id,
trx_t trx,
ut_stage_alter_t stage 
)
noexcept

Constructor.

Parameters
[in]space_idtable space id
[in]trxtrx instance
[in]stageperformance schema accounting object, used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages() for accounting.

◆ ~FlushObserver()

FlushObserver::~FlushObserver ( )
noexcept

Destructor.

Member Function Documentation

◆ check_interrupted()

bool FlushObserver::check_interrupted ( )

Check whether trx is interrupted.

Returns
true if trx is interrupted

◆ flush()

void FlushObserver::flush ( )

Flush dirty pages.

◆ interrupted()

void FlushObserver::interrupted ( )
inline

Interrupt observer not to wait.

◆ is_complete()

bool FlushObserver::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 FlushObserver::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 FlushObserver::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

Member Data Documentation

◆ m_flushed

Counters FlushObserver::m_flushed {}
private

Flush request sent, per buffer pool.

◆ m_interrupted

bool FlushObserver::m_interrupted {}
private

True if the operation was interrupted.

◆ m_n_ref_count

Counter FlushObserver::m_n_ref_count {}
private

Number of pages using this instance.

◆ m_removed

Counters FlushObserver::m_removed {}
private

Flush request finished, per buffer pool.

◆ m_space_id

space_id_t FlushObserver::m_space_id {}
private

Tablespace ID.

◆ m_stage

ut_stage_alter_t* FlushObserver::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* FlushObserver::m_trx {}
private

Trx instance.


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