![]() |
MySQL
8.0.23
Source Code Documentation
|
#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_t * | get_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... | |
FlushObserver * | get_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_t * | hash |
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 | |
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... | |
FlushObserver * | m_flush_observer {} |
Flush observer instance. More... | |
fil_space_t * | m_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... | |
|
inline |
Copy constructor.
[in] | other | Instance to copy from. |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
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.
|
inlinenoexcept |
|
inline |
Checks if this space reference saved during last page ID initialization was deleted or truncated since.
|
inlinenoexcept |
Retrieve the page number.
|
inlinenoexcept |
Remove the flush observer.
|
inline |
Sets stored value to invalid/empty value.
Handles space object reference count.
|
inline |
Sets stored page ID to the new value.
Handles space object reference count.
[in] | new_page_id | new page ID to be set. |
|
inlinenoexcept |
Set page to clean state.
|
inline |
Set the doublewrite buffer ID.
[in] | batch_id | Double write batch ID that flushed the page. |
|
inlinenoexcept |
Set the flush observer for the page.
[in] | flush_observer | The flush observer to set. |
|
inlinenoexcept |
Set the latest modification LSN.
[in] | lsn | Latest modification lSN. |
|
noexcept |
Set the LSN when the page is modified for the first time.
[in] | lsn | First modification LSN. |
|
inlinenoexcept |
Retrieve the tablespace id.
|
inlineprivate |
Updates new space reference and acquires "reference count latch" and the current version of the space object.
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:
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.
buf_page_t::UT_LIST_NODE_T | ( | buf_page_t | ) |
node of the LRU list
|
inline |
Checks if this space reference saved during last page ID initialization was deleted or truncated since.
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_atomic_t buf_page_t::buf_fix_count |
Count of how many fold this block is currently bufferfixed.
uint8_t buf_page_t::buf_pool_index |
Index number of the buffer pool that this block belongs to.
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.
buf_flush_t buf_page_t::flush_type |
If this block is currently being flushed to disk, this tells the flush_type.
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.
buf_page_t* buf_page_t::hash |
Node used in chaining to buf_pool->page_hash or buf_pool->zip_hash.
page_id_t buf_page_t::id |
Page id.
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
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)
bool buf_page_t::in_LRU_list |
true if the page is in the LRU list; used in debugging
bool buf_page_t::in_page_hash |
true if in buf_pool->page_hash
bool buf_page_t::in_zip_hash |
true if in buf_pool->zip_hash
buf_io_fix buf_page_t::io_fix |
Type of pending I/O operation.
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.
FlushObserver* buf_page_t::m_flush_observer {} |
Flush observer instance.
fil_space_t* buf_page_t::m_space {} |
Tablespace instance that this page belongs to.
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.
|
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()
bool buf_page_t::old |
true if the block is in the old blocks in buf_pool->LRU_old
|
private |
log sequence number of the youngest modification to this block, zero if not modified.
Protected by block mutex
page_size_t buf_page_t::size |
Page size.
buf_page_state buf_page_t::state |
Block state.
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