MySQL 8.4.2
Source Code Documentation
Btree_multi::Btree_load::Merger Class Reference

#include <btr0mtib.h>

Public Types

using Btree_loads = std::vector< Btree_load *, ut::allocator< Btree_load * > >
 

Public Member Functions

 Merger (Btree_loads &loads, dict_index_t *index, trx_t *trx)
 
dberr_t merge (bool sort)
 

Private Member Functions

size_t get_max_free () const
 Get the maximum free space available in an empty page in bytes. More...
 
void remove_empty_subtrees ()
 Remove any empty sub-trees with no records. More...
 
void validate_boundaries ()
 Validate sub-tree boundaries. More...
 
dberr_t subtree_link_levels (size_t &highest_level)
 Stich sub-trees together to form a tree with one or multiple nodes at highest leve. More...
 
dberr_t add_root_for_subtrees (const size_t highest_level)
 Create root node for the stiched sub-trees by combining the nodes at highest level creating another level if required. More...
 
dberr_t insert_node_ptrs (std::vector< dtuple_t * > &all_node_ptrs, size_t &total_node_ptrs_size, size_t level)
 Insert the given list of node pointers into pages at the given level. More...
 
void link_right_sibling (const page_no_t l_page_no, const page_no_t r_page_no)
 Load the left page and update its FIL_PAGE_NEXT. More...
 

Private Attributes

Btree_loadsm_btree_loads
 Refernce to the subtrees to be merged. More...
 
dict_index_tm_index {}
 Index which is being built. More...
 
trx_tm_trx {}
 Transaction making the changes. More...
 
Scoped_heap m_tuple_heap {}
 Memory heap to store node pointers. More...
 

Member Typedef Documentation

◆ Btree_loads

Constructor & Destructor Documentation

◆ Merger()

Btree_multi::Btree_load::Merger::Merger ( Btree_loads loads,
dict_index_t index,
trx_t trx 
)
inline

Member Function Documentation

◆ add_root_for_subtrees()

dberr_t Btree_multi::Btree_load::Merger::add_root_for_subtrees ( const size_t  highest_level)
private

Create root node for the stiched sub-trees by combining the nodes at highest level creating another level if required.

Parameters
[in]highest_levelhighest level of the merged tree.
Returns
innodb error code.

◆ get_max_free()

size_t Btree_multi::Btree_load::Merger::get_max_free ( ) const
inlineprivate

Get the maximum free space available in an empty page in bytes.

Returns
the maximum free space available in an empty page.

◆ insert_node_ptrs()

dberr_t Btree_multi::Btree_load::Merger::insert_node_ptrs ( std::vector< dtuple_t * > &  all_node_ptrs,
size_t &  total_node_ptrs_size,
size_t  level 
)
private

Insert the given list of node pointers into pages at the given level.

Parameters
[in,out]all_node_ptrslist of node pointers
[in,out]total_node_ptrs_sizetotal space in bytes needed to insert all the node pointers.
[in]levelthe level at which the node pointers are inserted.
Returns
DB_SUCCESS if successful.
error code on failure.

◆ link_right_sibling()

void Btree_multi::Btree_load::Merger::link_right_sibling ( const page_no_t  l_page_no,
const page_no_t  r_page_no 
)
private

Load the left page and update its FIL_PAGE_NEXT.

Parameters
[in]l_page_noleft page number
[in]r_page_noright page number.

◆ merge()

dberr_t Btree_multi::Btree_load::Merger::merge ( bool  sort)

◆ remove_empty_subtrees()

void Btree_multi::Btree_load::Merger::remove_empty_subtrees ( )
private

Remove any empty sub-trees with no records.

◆ subtree_link_levels()

dberr_t Btree_multi::Btree_load::Merger::subtree_link_levels ( size_t &  highest_level)
private

Stich sub-trees together to form a tree with one or multiple nodes at highest leve.

Parameters
[out]highest_levelhighest level of the merged tree.
Returns
innodb error code.

Loop till all subtrees are at same level or only one subtree remaining.

◆ validate_boundaries()

void Btree_multi::Btree_load::Merger::validate_boundaries ( )
private

Validate sub-tree boundaries.

Member Data Documentation

◆ m_btree_loads

Btree_loads& Btree_multi::Btree_load::Merger::m_btree_loads
private

Refernce to the subtrees to be merged.

◆ m_index

dict_index_t* Btree_multi::Btree_load::Merger::m_index {}
private

Index which is being built.

◆ m_trx

trx_t* Btree_multi::Btree_load::Merger::m_trx {}
private

Transaction making the changes.

◆ m_tuple_heap

Scoped_heap Btree_multi::Btree_load::Merger::m_tuple_heap {}
private

Memory heap to store node pointers.


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