MySQL 8.4.2
Source Code Documentation
Btree_multi::Page_extent Struct Reference

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_extentcreate (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_loadm_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
 

Detailed Description

Allocate, use, manage and flush one extent pages (FSP_EXTENT_SIZE).

Member Typedef Documentation

◆ Page_range_t

Constructor & Destructor Documentation

◆ Page_extent()

Btree_multi::Page_extent::Page_extent ( Btree_load btree_load,
const bool  is_leaf 
)
inline

Constructor.

Parameters
[in]btree_loadB-tree loader object.
[in]is_leaftrue if this is part of leaf segment, false if this is part of non-leaf (or top) segment.

◆ ~Page_extent()

Btree_multi::Page_extent::~Page_extent ( )
inline

Destructor.

Member Function Documentation

◆ alloc()

page_no_t Btree_multi::Page_extent::alloc ( )
inline

Allocate a page number.

◆ append()

void Btree_multi::Page_extent::append ( Page_load page_load)
inline

Save a page_load.

◆ bulk_flush()

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.

Parameters
[in,out]nodespace file node
[in,out]iovvector IO array
[in]iov_sizevector IO array size
Returns
DB_SUCCESS on success, error code on failure.

◆ create()

Page_extent * Btree_multi::Page_extent::create ( Btree_load btree_load,
const bool  is_leaf,
const bool  is_blob 
)
inlinestatic

Create an object of type Page_extent in the heap.

◆ destroy()

dberr_t Btree_multi::Page_extent::destroy ( )

Free all resources.

◆ destroy_cached()

void Btree_multi::Page_extent::destroy_cached ( )

Free any cached page load entries.

◆ drop()

void Btree_multi::Page_extent::drop ( Page_extent extent)
inlinestatic

Release the page extent.

Delete if not cached.

Parameters
[in]extentextent to release

◆ flush()

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.

Parameters
[in,out]nodespace file node
[in,out]iovvector IO array
[in]iov_sizevector IO array size
Returns
On success, return DB_SUCCESS.

◆ flush_one_by_one()

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.

Parameters
[in,out]nodespace file node
Returns
On success, return DB_SUCCESS.

◆ init()

void Btree_multi::Page_extent::init ( void  )
inline

Initialize the next page number to be allocated.

The page range should have been already initialized.

◆ is_cached()

bool Btree_multi::Page_extent::is_cached ( ) const
inline
Returns
true iff it is a cached extent.

◆ is_free()

bool Btree_multi::Page_extent::is_free ( ) const
inline
Returns
true iff the cached element is in free state.

◆ is_fully_used()

bool Btree_multi::Page_extent::is_fully_used ( ) const
inline

Check if no more pages are there to be used.

Returns
true if the page extent is completed used.
false if the page extent has more pages to be used.

◆ is_null()

bool Btree_multi::Page_extent::is_null ( ) const
inline

◆ is_page_loads_full()

bool Btree_multi::Page_extent::is_page_loads_full ( ) const
inline

◆ is_valid()

bool Btree_multi::Page_extent::is_valid ( void  ) const
inline

Check if the range is valid.

Returns
true if the range is valid, false otherwise.

◆ page_count()

page_no_t Btree_multi::Page_extent::page_count ( ) const
inline

Number of pages in this extent.

◆ pages_to_free()

Page_range_t Btree_multi::Page_extent::pages_to_free ( ) const

◆ print()

std::ostream & Btree_multi::Page_extent::print ( std::ostream &  out) const
inline

◆ reset_cached_page_loads()

void Btree_multi::Page_extent::reset_cached_page_loads ( )
inline

Reaset page load cache to free all.

◆ reset_range()

void Btree_multi::Page_extent::reset_range ( const Page_range_t range)
inline

Reset the range with the given value.

Parameters
[in]rangenew range value to be used.

◆ set_cached()

void Btree_multi::Page_extent::set_cached ( )
inline

Mark the extent as cached.

Flush thread should not free this extent.

◆ set_state()

void Btree_multi::Page_extent::set_state ( bool  free)
inline

Set and unset free state of a cached extent.

Parameters
[in]freestate to be set

◆ space()

space_id_t Btree_multi::Page_extent::space ( ) const
inline

◆ used_pages()

size_t Btree_multi::Page_extent::used_pages ( ) const
inline

Calculate the number of used pages.

return the number of used pages.

Friends And Related Function Documentation

◆ Level_ctx

friend struct Level_ctx
friend

Member Data Documentation

◆ m_btree_load

Btree_load* Btree_multi::Page_extent::m_btree_load {}
private

◆ m_cached_page_loads

std::vector<Page_load *> Btree_multi::Page_extent::m_cached_page_loads
private

Cached page loads.

◆ m_is_cached

std::atomic_bool Btree_multi::Page_extent::m_is_cached {false}
private

true iff the the extent is cached.

◆ m_is_free

std::atomic_bool Btree_multi::Page_extent::m_is_free {true}
private

true if the cached entry is free to be used.

◆ m_is_leaf

const bool Btree_multi::Page_extent::m_is_leaf
private

◆ m_next_cached_page_load_index

size_t Btree_multi::Page_extent::m_next_cached_page_load_index {0}
private

Next cached page load index.

◆ m_page_loads

std::vector<Page_load *> Btree_multi::Page_extent::m_page_loads

All the page loaders of the used pages.

◆ m_page_no

page_no_t Btree_multi::Page_extent::m_page_no {FIL_NULL}

Next page number to be used.

◆ m_range

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.


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