MySQL 9.1.0
Source Code Documentation
|
Allocate, use, manage and flush one extent pages (FSP_EXTENT_SIZE). More...
#include <btr0mtib.h>
Public Types | |
using | Page_range_t = std::pair< page_no_t, page_no_t > |
Public Member Functions | |
Page_extent (Btree_load *btree_load, const bool is_leaf) | |
Constructor. More... | |
~Page_extent () | |
Destructor. More... | |
bool | is_btree_load_nullptr () const |
page_no_t | page_count () const |
Number of pages in this extent. More... | |
void | reset_range (const Page_range_t &range) |
Reset the range with the given value. More... | |
size_t | used_pages () const |
Calculate the number of used pages. More... | |
void | get_page_numbers (std::vector< page_no_t > &page_numbers) const |
size_t | last () const |
Get the index of the first unused page load. More... | |
bool | is_valid () const |
Check if the range is valid. More... | |
bool | is_null () const |
Page_load * | get_page_load (page_no_t page_no) |
Member of Page_extent. More... | |
void | set_page_load (page_no_t page_no, Page_load *page_load) |
Member of Page_extent. More... | |
Page_range_t | pages_to_free () const |
void | init () |
Initialize the next page number to be allocated. More... | |
bool | is_fully_used () const |
Check if no more pages are there to be used. More... | |
bool | is_any_used () const |
Check if there are any pages used. More... | |
page_no_t | alloc () |
Allocate a page number. More... | |
void | append (Page_load *page_load) |
Save a page_load. More... | |
dberr_t | flush (fil_node_t *node, void *iov, size_t iov_size) |
Flush the used pages to disk. More... | |
dberr_t | flush_one_by_one (fil_node_t *node) |
Flush one page at a time. More... | |
dberr_t | bulk_flush (fil_node_t *node, void *iov, size_t iov_size) |
Flush 1 extent pages at a time. More... | |
dberr_t | destroy () |
Free all resources. More... | |
void | destroy_cached () |
Free any cached page load entries. More... | |
space_id_t | space () const |
void | set_cached () |
Mark the extent as cached. More... | |
void | set_state (bool free) |
Set and unset free state of a cached extent. More... | |
bool | is_free () const |
bool | is_cached () const |
void | reset_cached_page_loads () |
Reset page load cache to free all. More... | |
std::ostream & | print (std::ostream &out) const |
void | set_blob () |
Mark that this extent is used for blobs. More... | |
bool | is_blob () const |
Check if this is a blob extent. More... | |
void | free_memory_blocks () |
Free the BUF_BLOCK_MEMORY blocks used by this extent. More... | |
Static Public Member Functions | |
static Page_extent * | create (Btree_load *btree_load, const bool is_leaf, const bool is_blob) |
Create an object of type Page_extent in the heap. More... | |
static void | drop (Page_extent *extent) |
Release the page extent. More... | |
Public Attributes | |
page_no_t | m_page_no {FIL_NULL} |
Next page number to be used. More... | |
Page_range_t | m_range {FIL_NULL, FIL_NULL} |
Page numbers of the pages that has been allocated in this extent. More... | |
std::vector< Page_load * > | m_page_loads |
All the page loaders of the used pages. More... | |
std::atomic_bool | m_is_owned_by_bulk_flusher {false} |
True if this extent has been handed over to the bulk flusher. More... | |
Private Attributes | |
Btree_load * | m_btree_load {nullptr} |
bool | m_is_leaf {true} |
true if this extent belongs to leaf segment. More... | |
std::atomic_bool | m_is_cached {false} |
true iff the the extent is cached. More... | |
std::atomic_bool | m_is_free {true} |
true if the cached entry is free to be used. More... | |
std::vector< Page_load * > | m_cached_page_loads |
Cached page loads. More... | |
size_t | m_next_cached_page_load_index {0} |
Next cached page load index. More... | |
bool | m_is_blob {false} |
True if this extent is used for blobs. More... | |
Friends | |
struct | Level_ctx |
Allocate, use, manage and flush one extent pages (FSP_EXTENT_SIZE).
using Btree_multi::Page_extent::Page_range_t = std::pair<page_no_t, page_no_t> |
|
inline |
Constructor.
[in] | btree_load | B-tree loader object. |
[in] | is_leaf | true if this is part of leaf segment, false if this is part of non-leaf (or top) segment. |
|
inline |
Destructor.
|
inline |
Allocate a page number.
|
inline |
Save a page_load.
dberr_t Btree_multi::Page_extent::bulk_flush | ( | fil_node_t * | node, |
void * | iov, | ||
size_t | iov_size | ||
) |
Flush 1 extent pages at a time.
Internally it will call OS dependent API (either bulk_flush_win() on Windows or bulk_flush_linux() on other operating systems.
[in,out] | node | space file node |
[in,out] | iov | vector IO array |
[in] | iov_size | vector IO array size |
|
inlinestatic |
Create an object of type Page_extent in the heap.
dberr_t Btree_multi::Page_extent::destroy | ( | ) |
Free all resources.
void Btree_multi::Page_extent::destroy_cached | ( | ) |
Free any cached page load entries.
|
inlinestatic |
Release the page extent.
Delete if not cached.
[in] | extent | extent to release |
dberr_t Btree_multi::Page_extent::flush | ( | fil_node_t * | node, |
void * | iov, | ||
size_t | iov_size | ||
) |
Flush the used pages to disk.
It also frees the unused pages back to the segment.
[in,out] | node | space file node |
[in,out] | iov | vector IO array |
[in] | iov_size | vector IO array size |
dberr_t Btree_multi::Page_extent::flush_one_by_one | ( | fil_node_t * | node | ) |
Flush one page at a time.
This can be used when scatter/gather i/o is not available for use.
[in,out] | node | space file node |
|
inline |
Free the BUF_BLOCK_MEMORY blocks used by this extent.
Member of Page_extent.
The index of page_load objects in the m_page_loads corresponds to the page_no in the m_range. Here, check if a page_no already has a Page_load object.
[in] | page_no | page_no for which we are looking for Page_load obj. |
|
inline |
|
inline |
Initialize the next page number to be allocated.
The page range should have been already initialized.
|
inline |
Check if there are any pages used.
|
inline |
Check if this is a blob extent.
|
inline |
|
inline |
|
inline |
|
inline |
Check if no more pages are there to be used.
|
inline |
|
inline |
Check if the range is valid.
|
inline |
Get the index of the first unused page load.
|
inline |
Number of pages in this extent.
Page_range_t Btree_multi::Page_extent::pages_to_free | ( | ) | const |
|
inline |
|
inline |
Reset page load cache to free all.
|
inline |
Reset the range with the given value.
[in] | range | new range value to be used. |
|
inline |
Mark that this extent is used for blobs.
|
inline |
Mark the extent as cached.
Flush thread should not free this extent.
Member of Page_extent.
Associate the given page_no and the page load object.
[in] | page_no | page number to associate. |
[in] | page_load | page load object to associate. |
|
inline |
Set and unset free state of a cached extent.
[in] | free | state to be set |
|
inline |
|
inline |
Calculate the number of used pages.
return the number of used pages.
|
friend |
|
private |
|
private |
Cached page loads.
|
private |
True if this extent is used for blobs.
|
private |
true iff the the extent is cached.
|
private |
true if the cached entry is free to be used.
|
private |
true if this extent belongs to leaf segment.
std::atomic_bool Btree_multi::Page_extent::m_is_owned_by_bulk_flusher {false} |
True if this extent has been handed over to the bulk flusher.
|
private |
Next cached page load index.
std::vector<Page_load *> Btree_multi::Page_extent::m_page_loads |
All the page loaders of the used pages.
Page_range_t Btree_multi::Page_extent::m_range {FIL_NULL, FIL_NULL} |
Page numbers of the pages that has been allocated in this extent.
The page range is [p1, p2), where p2 is not included.