MySQL 9.1.0
Source Code Documentation
Buf_flush_list_added_lsns Class Reference

Tracks the concurrent executions of adding dirty pages to the flush lists. More...

#include <buf0flu.h>

Public Member Functions

void validate_not_added (lsn_t begin, lsn_t end)
 Validates using assertions that the specified LSN range is not yet added to the flush lists. More...
 
void assume_added_up_to (lsn_t start_lsn)
 Assume that the start_lsn is the start lsn of the first mini-transaction, for which report_added(mtr.start_lsn, mtr.end_lsn) was not yet called. More...
 
void report_added (lsn_t oldest_modification, lsn_t newest_modification)
 Used to report that we know that all changes in a specified range of lsns were already applied to pages in BP and all these pages were already added to corresponding flush lists. More...
 
uint64_t order_lag ()
 The flush lists are not completely sorted, and the amount of disorder is limited by the order_lag() - which is controlled by immutable srv_buf_flush_list_added_size sysvar - in the following way. More...
 
lsn_t smallest_not_added_lsn ()
 Return lsn up to which we know that all dirty pages with smaller oldest_modification were added to the flush list. More...
 
void wait_to_add (lsn_t oldest_modification)
 Wait until it is safe to add dirty pages with a given oldest_modification lsn to flush list without exceeding the disorder limit imposed by older_lag(). More...
 

Static Public Member Functions

static Buf_flush_list_added_lsns_aligned_ptr create ()
 Factory method that creates a dynamically allocated instance that is aligned to the cache line boundary. More...
 

Private Member Functions

 Buf_flush_list_added_lsns ()
 Constructor. More...
 

Private Attributes

Link_buf< lsn_tm_buf_added_lsns
 Ring buffer that keeps track of the ranges of LSNs added to flush_list(s) already. More...
 

Friends

template<typename T , typename... Args>
T * ut::aligned_new_withkey (ut::PSI_memory_key_t key, std::size_t alignment, Args &&...args)
 

Detailed Description

Tracks the concurrent executions of adding dirty pages to the flush lists.

It allows to relax order in which dirty pages have to be added to the flush lists and helps in advancing the checkpoint LSN. Note : Earlier it was known as recent_closed buffer.

Constructor & Destructor Documentation

◆ Buf_flush_list_added_lsns()

Buf_flush_list_added_lsns::Buf_flush_list_added_lsns ( )
private

Constructor.

Clients must use factory method to create an instance

Member Function Documentation

◆ assume_added_up_to()

void Buf_flush_list_added_lsns::assume_added_up_to ( lsn_t  start_lsn)

Assume that the start_lsn is the start lsn of the first mini-transaction, for which report_added(mtr.start_lsn, mtr.end_lsn) was not yet called.

Before the call smallest_not_added_lsn() can't be larger than start_lsn. During the call smallest_not_added_lsn() becomes start_lsn.

Parameters
[in]start_lsnLSNs that are already flushed.

◆ create()

Buf_flush_list_added_lsns_aligned_ptr Buf_flush_list_added_lsns::create ( )
static

Factory method that creates a dynamically allocated instance that is aligned to the cache line boundary.

This is needed since C++17 doesn't guarantee allocating aligned types dynamically

◆ order_lag()

uint64_t Buf_flush_list_added_lsns::order_lag ( )

The flush lists are not completely sorted, and the amount of disorder is limited by the order_lag() - which is controlled by immutable srv_buf_flush_list_added_size sysvar - in the following way.

If page A is added before page B in a flush_list, then it must hold that A.oldest_modification returned value < B.oldest_modification.

Returns
the maximum lsn distance the subsequent elements of the flush list can lag behind the first element w.r.t. oldest_modification

◆ report_added()

void Buf_flush_list_added_lsns::report_added ( lsn_t  oldest_modification,
lsn_t  newest_modification 
)

Used to report that we know that all changes in a specified range of lsns were already applied to pages in BP and all these pages were already added to corresponding flush lists.

The committing mtr should use this function to report that it has added all the pages that it has dirtied to corresponding flush lists already. The newest_modification should be the mtr->commit_lsn(). The oldest_modification should be the start_lsn assigned to the mtr (which equals commit_lsn() of the previous mtr).

Information from these reports is used by smallest_not_added_lsn() to establish the smallest not yet reported lsn, which in turn can be used by page cleaners, or other mtrs which are currently waiting for their turn in wait_to_add().

Parameters
[in]oldest_modificationstart lsn of the range
[in]newest_modificationend lsn fo the range

◆ smallest_not_added_lsn()

lsn_t Buf_flush_list_added_lsns::smallest_not_added_lsn ( )

Return lsn up to which we know that all dirty pages with smaller oldest_modification were added to the flush list.

Returns
The smallest lsn for which there was no call to assume_added_up_to(y) with lsn<y nor to report_added(x,y) with x<=lsn<y yet

◆ validate_not_added()

void Buf_flush_list_added_lsns::validate_not_added ( lsn_t  begin,
lsn_t  end 
)

Validates using assertions that the specified LSN range is not yet added to the flush lists.

Parameters
[in]beginstart LSN of the range
[in]endend LSN of the range

◆ wait_to_add()

void Buf_flush_list_added_lsns::wait_to_add ( lsn_t  oldest_modification)

Wait until it is safe to add dirty pages with a given oldest_modification lsn to flush list without exceeding the disorder limit imposed by older_lag().

This function will block and wait until all the pages having page.oldest_modification smaller than oldest_modification - older_lag() are reported to be added to flush list by other threads.

Parameters
[in]oldest_modificationOldest LSN that does not violate the order_lag()

Friends And Related Function Documentation

◆ ut::aligned_new_withkey

template<typename T , typename... Args>
T * ut::aligned_new_withkey ( ut::PSI_memory_key_t  key,
std::size_t  alignment,
Args &&...  args 
)
friend

Member Data Documentation

◆ m_buf_added_lsns

Link_buf<lsn_t> Buf_flush_list_added_lsns::m_buf_added_lsns
private

Ring buffer that keeps track of the ranges of LSNs added to flush_list(s) already.


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