MySQL 8.0.31
Source Code Documentation
btr0btr.ic File Reference

The B-tree. More...

#include "mach0data.h"
#include "mtr0log.h"
#include "mtr0mtr.h"
#include "page0zip.h"

Functions

static buf_block_tbtr_block_get_func (const page_id_t &page_id, const page_size_t &page_size, ulint mode, ut::Location location, const dict_index_t *index, mtr_t *mtr)
 
static void btr_page_set_index_id (page_t *page, page_zip_des_t *page_zip, space_index_t id, mtr_t *mtr)
 Sets the index id field of a page. More...
 
static space_index_t btr_page_get_index_id (const page_t *page)
 Gets the index id field of a page. More...
 
static ulint btr_page_get_level (const page_t *page)
 Gets the node level field in an index page. More...
 
static void btr_page_set_level (page_t *page, page_zip_des_t *page_zip, ulint level, mtr_t *mtr)
 Sets the node level field in an index page. More...
 
static page_no_t btr_page_get_next (const page_t *page, mtr_t *mtr)
 
static void btr_page_set_next (page_t *page, page_zip_des_t *page_zip, page_no_t next, mtr_t *mtr)
 Sets the next index page field. More...
 
static page_no_t btr_page_get_prev (const page_t *page, mtr_t *mtr)
 
static void btr_page_set_prev (page_t *page, page_zip_des_t *page_zip, page_no_t prev, mtr_t *mtr)
 Sets the previous index page field. More...
 
static page_no_t btr_node_ptr_get_child_page_no (const rec_t *rec, const ulint *offsets)
 
static void btr_leaf_page_release (buf_block_t *block, ulint latch_mode, mtr_t *mtr)
 Releases the latches on a leaf page and bufferunfixes it. More...
 

Variables

constexpr uint32_t BTR_MAX_NODE_LEVEL = 45
 NOTE - Changing this from the original number of 50 to 45 as insert_debug.test was failing in ASAN build because of a stack overflow issue. More...
 

Detailed Description

The B-tree.

Created 6/2/1994 Heikki Tuuri

Function Documentation

◆ btr_block_get_func()

static buf_block_t * btr_block_get_func ( const page_id_t page_id,
const page_size_t page_size,
ulint  mode,
ut::Location  location,
const dict_index_t index,
mtr_t mtr 
)
inlinestatic

◆ btr_leaf_page_release()

static void btr_leaf_page_release ( buf_block_t block,
ulint  latch_mode,
mtr_t mtr 
)
inlinestatic

Releases the latches on a leaf page and bufferunfixes it.

Parameters
blockin: buffer block
latch_modein: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF
mtrin: mtr

◆ btr_node_ptr_get_child_page_no()

static page_no_t btr_node_ptr_get_child_page_no ( const rec_t rec,
const ulint offsets 
)
inlinestatic

◆ btr_page_get_index_id()

static space_index_t btr_page_get_index_id ( const page_t page)
inlinestatic

Gets the index id field of a page.

Returns
index id
Parameters
pagein: index page

◆ btr_page_get_level()

static ulint btr_page_get_level ( const page_t page)
inlinestatic

Gets the node level field in an index page.

Parameters
[in]pageindex page
Returns
level, leaf level == 0

◆ btr_page_get_next()

static page_no_t btr_page_get_next ( const page_t page,
mtr_t mtr 
)
inlinestatic

◆ btr_page_get_prev()

static page_no_t btr_page_get_prev ( const page_t page,
mtr_t mtr 
)
inlinestatic

◆ btr_page_set_index_id()

static void btr_page_set_index_id ( page_t page,
page_zip_des_t page_zip,
space_index_t  id,
mtr_t mtr 
)
inlinestatic

Sets the index id field of a page.

Parameters
pagein: page to be created
page_zipin: compressed page whose uncompressed part will be updated, or NULL
idin: index id
mtrin: mtr

◆ btr_page_set_level()

static void btr_page_set_level ( page_t page,
page_zip_des_t page_zip,
ulint  level,
mtr_t mtr 
)
inlinestatic

Sets the node level field in an index page.

Parameters
pagein: index page
page_zipin: compressed page whose uncompressed part will be updated, or NULL
levelin: level, leaf level == 0
mtrin: mini-transaction handle

◆ btr_page_set_next()

static void btr_page_set_next ( page_t page,
page_zip_des_t page_zip,
page_no_t  next,
mtr_t mtr 
)
inlinestatic

Sets the next index page field.

Parameters
pagein: index page
page_zipin: compressed page whose uncompressed part will be updated, or NULL
nextin: next page number
mtrin: mini-transaction handle

◆ btr_page_set_prev()

static void btr_page_set_prev ( page_t page,
page_zip_des_t page_zip,
page_no_t  prev,
mtr_t mtr 
)
inlinestatic

Sets the previous index page field.

Parameters
pagein: index page
page_zipin: compressed page whose uncompressed part will be updated, or NULL
previn: previous page number
mtrin: mini-transaction handle

Variable Documentation

◆ BTR_MAX_NODE_LEVEL

constexpr uint32_t BTR_MAX_NODE_LEVEL = 45
constexpr

NOTE - Changing this from the original number of 50 to 45 as insert_debug.test was failing in ASAN build because of a stack overflow issue.

It was found that rtr_info_t was taking up a lot of stack space in the function btr_insert_on_non_leaf_level_func which is part of the recursive stack trace. Maximum B-tree page level (not really a hard limit). Used in debug assertions in btr_page_set_level and btr_page_get_level