MySQL  8.0.23
Source Code Documentation
buf_page_t Class Reference

#include <buf0buf.h>

Public Member Functions

 buf_page_t (const buf_page_t &other)
 Copy constructor. More...
 
void set_dblwr_batch_id (uint16_t batch_id)
 Set the doublewrite buffer ID. More...
 
uint16_t get_dblwr_batch_id () const
 
space_id_t space () const noexcept
 Retrieve the tablespace id. More...
 
page_no_t page_no () const noexcept
 Retrieve the page number. More...
 
bool is_stale () const
 Checks if this space reference saved during last page ID initialization was deleted or truncated since. More...
 
bool was_stale () const
 Checks if this space reference saved during last page ID initialization was deleted or truncated since. More...
 
fil_space_tget_space () const
 Retrieve the tablespace object if one was available during page ID initialization. More...
 
void reset_page_id (page_id_t new_page_id)
 Sets stored page ID to the new value. More...
 
void reset_page_id ()
 Sets stored value to invalid/empty value. More...
 
FlushObserverget_flush_observer () noexcept
 
void set_flush_observer (FlushObserver *flush_observer) noexcept
 Set the flush observer for the page. More...
 
void reset_flush_observer () noexcept
 Remove the flush observer. More...
 
lsn_t get_newest_lsn () const noexcept
 
lsn_t get_oldest_lsn () const noexcept
 
bool is_dirty () const noexcept
 
void set_newest_lsn (lsn_t lsn) noexcept
 Set the latest modification LSN. More...
 
void set_oldest_lsn (lsn_t lsn) noexcept
 Set the LSN when the page is modified for the first time. More...
 
void set_clean () noexcept
 Set page to clean state. More...
 

Public Attributes

buf_page_thash
 Node used in chaining to buf_pool->page_hash or buf_pool->zip_hash. More...
 
uint32_t access_time
 Time of first access, or 0 if the block was never accessed in the buffer pool. More...
 
uint32_t m_version {}
 Version of fil_space_t when the page was updated. More...
 
uint16_t m_dblwr_id {}
 Double write instance ordinal value during writes. More...
 
bool old
 true if the block is in the old blocks in buf_pool->LRU_old More...
 
bool file_page_was_freed
 This is set to TRUE when fsp frees a page in buffer pool; protected by buf_pool->zip_mutex or buf_block_t::mutex. More...
 
bool in_flush_list
 TRUE if in buf_pool->flush_list; when buf_pool->flush_list_mutex is free, the following should hold: in_flush_list == (state == BUF_BLOCK_FILE_PAGE || state == BUF_BLOCK_ZIP_DIRTY) Writes to this field must be covered by both buf_pool->flush_list_mutex and block->mutex. More...
 
bool in_free_list
 true if in buf_pool->free; when buf_pool->free_list_mutex is free, the following should hold: in_free_list == (state == BUF_BLOCK_NOT_USED) More...
 
bool in_LRU_list
 true if the page is in the LRU list; used in debugging More...
 
bool in_page_hash
 true if in buf_pool->page_hash More...
 
bool in_zip_hash
 true if in buf_pool->zip_hash More...
 
General fields

None of these bit-fields must be modified without holding buf_page_get_mutex() [buf_block_t::mutex or buf_pool->zip_mutex], since they can be stored in the same machine word.


page_id_t id
 Page id. More...
 
page_size_t size
 Page size. More...
 
buf_fix_count_atomic_t buf_fix_count
 Count of how many fold this block is currently bufferfixed. More...
 
buf_io_fix io_fix
 Type of pending I/O operation. More...
 
buf_page_state state
 Block state. More...
 
buf_flush_t flush_type
 If this block is currently being flushed to disk, this tells the flush_type. More...
 
uint8_t buf_pool_index
 Index number of the buffer pool that this block belongs to. More...
 

Private Member Functions

void space_id_changed ()
 Updates new space reference and acquires "reference count latch" and the current version of the space object. More...
 

Page flushing fields

All these are protected by buf_pool->mutex.

lsn_t newest_modification
 The flush LSN, LSN when this page was written to the redo log. More...
 
lsn_t oldest_modification
 log sequence number of the youngest modification to this block, zero if not modified. More...
 
 UT_LIST_NODE_T (buf_page_t) list
 Based on state, this is a list node, protected by the corresponding list mutex, in one of the following lists in buf_pool: More...
 

LRU replacement algorithm fields

log sequence number of the START of the log entry written of the oldest modification to this block which has not yet been flushed on disk; zero if all modifications are on disk.

Writes to this field must be covered by both block->mutex and buf_pool->flush_list_mutex. Hence reads can happen while holding any one of the two mutexes

These fields are protected by both buf_pool->LRU_list_mutex and the block mutex.

page_zip_des_t zip
 compressed page; zip.data (but not the data it points to) is protected by buf_pool->zip_mutex; state == BUF_BLOCK_ZIP_PAGE and zip.data == NULL means an active buf_pool->watch More...
 
FlushObserverm_flush_observer {}
 Flush observer instance. More...
 
fil_space_tm_space {}
 Tablespace instance that this page belongs to. More...
 
uint32_t freed_page_clock
 The value of buf_pool->freed_page_clock when this block was the last time put to the head of the LRU list; a thread is allowed to read this for heuristic purposes without holding any mutex or latch. More...
 
 UT_LIST_NODE_T (buf_page_t) LRU
 node of the LRU list More...
 

Constructor & Destructor Documentation

◆ buf_page_t()

buf_page_t::buf_page_t ( const buf_page_t other)
inline

Copy constructor.

Parameters
[in]otherInstance to copy from.

Member Function Documentation

◆ get_dblwr_batch_id()

uint16_t buf_page_t::get_dblwr_batch_id ( ) const
inline
Returns
the double write batch id, or uint16_t max if undefined.

◆ get_flush_observer()

FlushObserver* buf_page_t::get_flush_observer ( )
inlinenoexcept
Returns
the flush observer instance.

◆ get_newest_lsn()

lsn_t buf_page_t::get_newest_lsn ( ) const
inlinenoexcept
Returns
the LSN of the latest modification.

◆ get_oldest_lsn()

lsn_t buf_page_t::get_oldest_lsn ( ) const
inlinenoexcept
Returns
the LSN of the first modification since the last time it was clean.

◆ get_space()

fil_space_t* buf_page_t::get_space ( ) const
inline

Retrieve the tablespace object if one was available during page ID initialization.

The returned object is safe to use as long as this buf_page_t object is not changed. Caller should have a IO fix, buffer fix, mutex or any other mean to assure the page will not be freed. After that is released the space object may be freed.

Returns
tablespace object

◆ is_dirty()

bool buf_page_t::is_dirty ( ) const
inlinenoexcept
Returns
true if the page is dirty.

◆ is_stale()

bool buf_page_t::is_stale ( ) const
inline

Checks if this space reference saved during last page ID initialization was deleted or truncated since.

Returns
true when space reference stored leads was deleted or truncated and this page should be discarded. Result is up to date until the fil_shard mutex is released.

◆ page_no()

page_no_t buf_page_t::page_no ( ) const
inlinenoexcept

Retrieve the page number.

Returns
page number

◆ reset_flush_observer()

void buf_page_t::reset_flush_observer ( )
inlinenoexcept

Remove the flush observer.

◆ reset_page_id() [1/2]

void buf_page_t::reset_page_id ( )
inline

Sets stored value to invalid/empty value.

Handles space object reference count.

◆ reset_page_id() [2/2]

void buf_page_t::reset_page_id ( page_id_t  new_page_id)
inline

Sets stored page ID to the new value.

Handles space object reference count.

Parameters
[in]new_page_idnew page ID to be set.

◆ set_clean()

void buf_page_t::set_clean ( )
inlinenoexcept

Set page to clean state.

◆ set_dblwr_batch_id()

void buf_page_t::set_dblwr_batch_id ( uint16_t  batch_id)
inline

Set the doublewrite buffer ID.

Parameters
[in]batch_idDouble write batch ID that flushed the page.

◆ set_flush_observer()

void buf_page_t::set_flush_observer ( FlushObserver flush_observer)
inlinenoexcept

Set the flush observer for the page.

Parameters
[in]flush_observerThe flush observer to set.

◆ set_newest_lsn()

void buf_page_t::set_newest_lsn ( lsn_t  lsn)
inlinenoexcept

Set the latest modification LSN.

Parameters
[in]lsnLatest modification lSN.

◆ set_oldest_lsn()

void buf_page_t::set_oldest_lsn ( lsn_t  lsn)
noexcept

Set the LSN when the page is modified for the first time.

Parameters
[in]lsnFirst modification LSN.

◆ space()

space_id_t buf_page_t::space ( ) const
inlinenoexcept

Retrieve the tablespace id.

Returns
tablespace id

◆ space_id_changed()

void buf_page_t::space_id_changed ( )
inlineprivate

Updates new space reference and acquires "reference count latch" and the current version of the space object.

◆ UT_LIST_NODE_T() [1/2]

buf_page_t::UT_LIST_NODE_T ( buf_page_t  )

Based on state, this is a list node, protected by the corresponding list mutex, in one of the following lists in buf_pool:

  • BUF_BLOCK_NOT_USED: free, withdraw
  • BUF_BLOCK_FILE_PAGE: flush_list
  • BUF_BLOCK_ZIP_DIRTY: flush_list
  • BUF_BLOCK_ZIP_PAGE: zip_clean

The node pointers are protected by the corresponding list mutex.

The contents of the list node is undefined if !in_flush_list && state == BUF_BLOCK_FILE_PAGE, or if state is one of BUF_BLOCK_MEMORY, BUF_BLOCK_REMOVE_HASH or BUF_BLOCK_READY_IN_USE.

◆ UT_LIST_NODE_T() [2/2]

buf_page_t::UT_LIST_NODE_T ( buf_page_t  )

node of the LRU list

◆ was_stale()

bool buf_page_t::was_stale ( ) const
inline

Checks if this space reference saved during last page ID initialization was deleted or truncated since.

Returns
true when space reference stored leads was deleted or truncated and this page should be discarded. When false is returned, the status of stale is checked to be guaranteed.

Member Data Documentation

◆ access_time

uint32_t buf_page_t::access_time

Time of first access, or 0 if the block was never accessed in the buffer pool.

Protected by block mutex

◆ buf_fix_count

buf_fix_count_atomic_t buf_page_t::buf_fix_count

Count of how many fold this block is currently bufferfixed.

◆ buf_pool_index

uint8_t buf_page_t::buf_pool_index

Index number of the buffer pool that this block belongs to.

◆ file_page_was_freed

bool buf_page_t::file_page_was_freed

This is set to TRUE when fsp frees a page in buffer pool; protected by buf_pool->zip_mutex or buf_block_t::mutex.

◆ flush_type

buf_flush_t buf_page_t::flush_type

If this block is currently being flushed to disk, this tells the flush_type.

See also
buf_flush_t

◆ freed_page_clock

uint32_t buf_page_t::freed_page_clock

The value of buf_pool->freed_page_clock when this block was the last time put to the head of the LRU list; a thread is allowed to read this for heuristic purposes without holding any mutex or latch.

◆ hash

buf_page_t* buf_page_t::hash

Node used in chaining to buf_pool->page_hash or buf_pool->zip_hash.

◆ id

page_id_t buf_page_t::id

Page id.

◆ in_flush_list

bool buf_page_t::in_flush_list

TRUE if in buf_pool->flush_list; when buf_pool->flush_list_mutex is free, the following should hold: in_flush_list == (state == BUF_BLOCK_FILE_PAGE || state == BUF_BLOCK_ZIP_DIRTY) Writes to this field must be covered by both buf_pool->flush_list_mutex and block->mutex.

Hence reads can happen while holding any one of the two mutexes

◆ in_free_list

bool buf_page_t::in_free_list

true if in buf_pool->free; when buf_pool->free_list_mutex is free, the following should hold: in_free_list == (state == BUF_BLOCK_NOT_USED)

◆ in_LRU_list

bool buf_page_t::in_LRU_list

true if the page is in the LRU list; used in debugging

◆ in_page_hash

bool buf_page_t::in_page_hash

true if in buf_pool->page_hash

◆ in_zip_hash

bool buf_page_t::in_zip_hash

true if in buf_pool->zip_hash

◆ io_fix

buf_io_fix buf_page_t::io_fix

Type of pending I/O operation.

◆ m_dblwr_id

uint16_t buf_page_t::m_dblwr_id {}

Double write instance ordinal value during writes.

This is used by IO completion (writes) to select the double write instance.

◆ m_flush_observer

FlushObserver* buf_page_t::m_flush_observer {}

Flush observer instance.

◆ m_space

fil_space_t* buf_page_t::m_space {}

Tablespace instance that this page belongs to.

◆ m_version

uint32_t buf_page_t::m_version {}

Version of fil_space_t when the page was updated.

It can also be viewed as the truncation number.

◆ newest_modification

lsn_t buf_page_t::newest_modification
private

The flush LSN, LSN when this page was written to the redo log.

For non redo logged pages this is set using: buf_flush_borrow_lsn()

◆ old

bool buf_page_t::old

true if the block is in the old blocks in buf_pool->LRU_old

◆ oldest_modification

lsn_t buf_page_t::oldest_modification
private

log sequence number of the youngest modification to this block, zero if not modified.

Protected by block mutex

◆ size

page_size_t buf_page_t::size

Page size.

◆ state

buf_page_state buf_page_t::state

Block state.

See also
buf_page_in_file

◆ zip

page_zip_des_t buf_page_t::zip

compressed page; zip.data (but not the data it points to) is protected by buf_pool->zip_mutex; state == BUF_BLOCK_ZIP_PAGE and zip.data == NULL means an active buf_pool->watch


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