MySQL 8.4.2
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... | |
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... | |
bool | is_valid () const |
Check if the range is valid. More... | |
bool | is_null () const |
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_page_loads_full () const |
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 () |
Reaset page load cache to free all. More... | |
std::ostream & | print (std::ostream &out) const |
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... | |
Private Attributes | |
Btree_load * | m_btree_load {} |
const bool | m_is_leaf |
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... | |
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 |
Initialize the next page number to be allocated.
The page range should have been already initialized.
|
inline |
|
inline |
|
inline |
Check if no more pages are there to be used.
|
inline |
|
inline |
|
inline |
Check if the range is valid.
|
inline |
Number of pages in this extent.
Page_range_t Btree_multi::Page_extent::pages_to_free | ( | ) | const |
|
inline |
|
inline |
Reaset page load cache to free all.
|
inline |
Reset the range with the given value.
[in] | range | new range value to be used. |
|
inline |
Mark the extent as cached.
Flush thread should not free this extent.
|
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 iff the the extent is cached.
|
private |
true if the cached entry is free to be used.
|
private |
|
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.