Commit af2d260b authored by Eugene Kosov's avatar Eugene Kosov

merge btr_page_get_level_low() and btr_page_get_level()

parent 9d46bd8a
......@@ -307,7 +307,7 @@ btr_height_get(
root_block = btr_root_block_get(index, RW_S_LATCH, mtr);
if (root_block) {
height = btr_page_get_level(buf_block_get_frame(root_block), mtr);
height = btr_page_get_level(buf_block_get_frame(root_block));
/* Release the S latch on the root page. */
mtr->memo_release(root_block, MTR_MEMO_PAGE_S_FIX);
......@@ -872,7 +872,7 @@ btr_page_free(
mtr_t* mtr) /*!< in: mtr */
{
const page_t* page = buf_block_get_frame(block);
ulint level = btr_page_get_level(page, mtr);
ulint level = btr_page_get_level(page);
ut_ad(fil_page_index_page_check(block->frame));
ut_ad(level != ULINT_UNDEFINED);
......@@ -976,7 +976,7 @@ btr_page_get_father_node_ptr_func(
ut_ad(dict_index_get_page(index) != page_no);
level = btr_page_get_level(btr_cur_get_page(cursor), mtr);
level = btr_page_get_level(btr_cur_get_page(cursor));
user_rec = btr_cur_get_rec(cursor);
ut_a(page_rec_is_user_rec(user_rec));
......@@ -2018,7 +2018,7 @@ btr_root_raise_and_insert(
moving the root records to the new page, emptying the root, putting
a node pointer to the new page, and then splitting the new page. */
level = btr_page_get_level(root, mtr);
level = btr_page_get_level(root);
new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr, mtr);
......@@ -2684,9 +2684,8 @@ btr_attach_half_pages(
}
/* Get the level of the split pages */
level = btr_page_get_level(buf_block_get_frame(block), mtr);
ut_ad(level
== btr_page_get_level(buf_block_get_frame(new_block), mtr));
level = btr_page_get_level(buf_block_get_frame(block));
ut_ad(level == btr_page_get_level(buf_block_get_frame(new_block)));
/* Build the node pointer (= node key and page address) for the upper
half */
......@@ -2870,7 +2869,7 @@ btr_insert_into_right_sibling(
ibool compressed;
dberr_t err;
ulint level = btr_page_get_level(next_page, mtr);
ulint level = btr_page_get_level(next_page);
/* adjust cursor position */
*btr_cur_get_page_cur(cursor) = next_page_cursor;
......@@ -3056,7 +3055,7 @@ btr_page_split_and_insert(
/* 2. Allocate a new page to the index */
new_block = btr_page_alloc(cursor->index, hint_page_no, direction,
btr_page_get_level(page, mtr), mtr, mtr);
btr_page_get_level(page), mtr, mtr);
if (new_block == NULL && os_has_said_disk_full) {
return(NULL);
......@@ -3065,7 +3064,7 @@ btr_page_split_and_insert(
new_page = buf_block_get_frame(new_block);
new_page_zip = buf_block_get_page_zip(new_block);
btr_page_create(new_block, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr);
btr_page_get_level(page), mtr);
/* Only record the leaf level page splits. */
if (page_is_leaf(page)) {
cursor->index->stat_defrag_n_page_split ++;
......@@ -3545,7 +3544,7 @@ btr_lift_page_up(
ut_ad(!page_has_siblings(page));
ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table));
page_level = btr_page_get_level(page, mtr);
page_level = btr_page_get_level(page);
root_page_no = dict_index_get_page(index);
{
......@@ -3607,7 +3606,7 @@ btr_lift_page_up(
block = father_block;
page = buf_block_get_frame(block);
page_level = btr_page_get_level(page, mtr);
page_level = btr_page_get_level(page);
ut_ad(!page_has_siblings(page));
ut_ad(mtr_is_block_fix(
......@@ -3687,7 +3686,7 @@ btr_lift_page_up(
page_t* page = buf_block_get_frame(blocks[i]);
page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]);
ut_ad(btr_page_get_level(page, mtr) == page_level + 1);
ut_ad(btr_page_get_level(page) == page_level + 1);
btr_page_set_level(page, page_zip, page_level, mtr);
#ifdef UNIV_ZIP_DEBUG
......@@ -4273,7 +4272,7 @@ btr_discard_only_page_on_level(
const page_t* page = buf_block_get_frame(block);
ut_a(page_get_n_recs(page) == 1);
ut_a(page_level == btr_page_get_level(page, mtr));
ut_a(page_level == btr_page_get_level(page));
ut_a(!page_has_siblings(page));
ut_ad(mtr_is_block_fix(
......@@ -4553,7 +4552,7 @@ btr_print_recursive(
ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_SX_FIX, index->table));
ib::info() << "NODE ON LEVEL " << btr_page_get_level(page, mtr)
ib::info() << "NODE ON LEVEL " << btr_page_get_level(page)
<< " page " << block->page.id;
page_print(block, index, width, width);
......@@ -4669,7 +4668,7 @@ btr_check_node_ptr(
tuple = dict_index_build_node_ptr(
index, page_rec_get_next(page_get_infimum_rec(page)), 0, heap,
btr_page_get_level(page, mtr));
btr_page_get_level(page));
/* For spatial index, the MBR in the parent rec could be different
with that of first rec of child, their relationship should be
......@@ -5000,7 +4999,7 @@ btr_validate_level(
return(false);
}
while (level != btr_page_get_level(page, &mtr)) {
while (level != btr_page_get_level(page)) {
const rec_t* node_ptr;
if (fseg_page_is_free(space, block->page.id.page_no())) {
......@@ -5108,7 +5107,7 @@ btr_validate_level(
ret = false;
}
ut_a(btr_page_get_level(page, &mtr) == level);
ut_a(btr_page_get_level(page) == level);
right_page_no = btr_page_get_next(page, &mtr);
left_page_no = btr_page_get_prev(page, &mtr);
......@@ -5253,7 +5252,7 @@ btr_validate_level(
node_ptr_tuple = dict_index_build_node_ptr(
index,
page_rec_get_next(page_get_infimum_rec(page)),
0, heap, btr_page_get_level(page, &mtr));
0, heap, btr_page_get_level(page));
if (cmp_dtuple_rec(node_ptr_tuple, node_ptr,
offsets)) {
......@@ -5431,7 +5430,7 @@ btr_validate_spatial_index(
mtr_x_lock(dict_index_get_lock(index), &mtr);
page_t* root = btr_root_get(index, &mtr);
ulint n = btr_page_get_level(root, &mtr);
ulint n = btr_page_get_level(root);
#ifdef UNIV_RTR_DEBUG
fprintf(stderr, "R-tree level is %lu\n", n);
......@@ -5498,7 +5497,7 @@ btr_validate_index(
return err;
}
ulint n = btr_page_get_level(root, &mtr);
ulint n = btr_page_get_level(root);
for (ulint i = 0; i <= n; ++i) {
......
......@@ -1513,7 +1513,7 @@ btr_cur_search_to_nth_level_func(
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
height = btr_page_get_level(page, mtr);
height = btr_page_get_level(page);
root_height = height;
cursor->tree_height = root_height + 1;
......@@ -1707,8 +1707,7 @@ btr_cur_search_to_nth_level_func(
/* If this is the desired level, leave the loop */
ut_ad(height == btr_page_get_level(page_cur_get_page(page_cursor),
mtr));
ut_ad(height == btr_page_get_level(page_cur_get_page(page_cursor)));
/* Add Predicate lock if it is serializable isolation
and only if it is in the search case */
......@@ -2408,12 +2407,12 @@ btr_cur_open_at_index_side_func(
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
height = btr_page_get_level(page, mtr);
height = btr_page_get_level(page);
root_height = height;
ut_a(height >= level);
} else {
/* TODO: flag the index corrupted if this fails */
ut_ad(height == btr_page_get_level(page, mtr));
ut_ad(height == btr_page_get_level(page));
}
if (height == level) {
......@@ -2768,7 +2767,7 @@ btr_cur_open_at_rnd_pos_func(
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
height = btr_page_get_level(page, mtr);
height = btr_page_get_level(page);
}
if (height == 0) {
......@@ -5677,7 +5676,7 @@ btr_cur_pessimistic_delete(
on the page */
btr_node_ptr_delete(index, block, mtr);
const ulint level = btr_page_get_level(page, mtr);
const ulint level = btr_page_get_level(page);
dtuple_t* node_ptr = dict_index_build_node_ptr(
index, next_rec, block->page.id.page_no(),
......@@ -5767,7 +5766,7 @@ btr_cur_add_path_info(
slot->nth_rec = page_rec_get_n_recs_before(rec);
slot->n_recs = page_get_n_recs(page);
slot->page_no = page_get_page_no(page);
slot->page_level = btr_page_get_level_low(page);
slot->page_level = btr_page_get_level(page);
}
/*******************************************************************//**
......@@ -5884,7 +5883,7 @@ btr_estimate_n_rows_in_range_on_level(
reuses them. */
if (!fil_page_index_page_check(page)
|| btr_page_get_index_id(page) != index->id
|| btr_page_get_level_low(page) != level) {
|| btr_page_get_level(page) != level) {
/* The page got reused for something else */
mtr_commit(&mtr);
......
......@@ -438,7 +438,7 @@ btr_defragment_merge_pages(
page_t* from_page = buf_block_get_frame(from_block);
page_t* to_page = buf_block_get_frame(to_block);
ulint space = dict_index_get_space(index);
ulint level = btr_page_get_level(from_page, mtr);
ulint level = btr_page_get_level(from_page);
ulint n_recs = page_get_n_recs(from_page);
ulint new_data_size = page_get_data_size(to_page);
ulint max_ins_size =
......@@ -623,7 +623,7 @@ btr_defragment_n_pages(
}
first_page = buf_block_get_frame(block);
level = btr_page_get_level(first_page, mtr);
level = btr_page_get_level(first_page);
const page_size_t page_size(dict_table_page_size(index->table));
if (level != 0) {
......
......@@ -5668,7 +5668,7 @@ buf_page_monitor(
case FIL_PAGE_TYPE_INSTANT:
case FIL_PAGE_INDEX:
case FIL_PAGE_RTREE:
level = btr_page_get_level_low(frame);
level = btr_page_get_level(frame);
/* Check if it is an index page for insert buffer */
if (fil_page_get_type(frame) == FIL_PAGE_INDEX
......
......@@ -1080,7 +1080,7 @@ dict_stats_analyze_index_level(
== page_rec_get_next_const(page_get_infimum_rec(page)));
/* check that we are indeed on the desired level */
ut_a(btr_page_get_level(page, mtr) == level);
ut_a(btr_page_get_level(page) == level);
/* there should not be any pages on the left */
ut_a(!page_has_prev(page));
......@@ -1701,7 +1701,7 @@ dict_stats_analyze_index_for_n_prefix(
ut_ad(first_rec == page_rec_get_next_const(page_get_infimum_rec(page)));
/* check that we are indeed on the desired level */
ut_a(btr_page_get_level(page, mtr) == n_diff_data->level);
ut_a(btr_page_get_level(page) == n_diff_data->level);
/* there should not be any pages on the left */
ut_a(!page_has_prev(page));
......
......@@ -310,7 +310,7 @@ rtr_update_mbr_field(
page_zip = buf_block_get_page_zip(block);
child = btr_node_ptr_get_child_page_no(rec, offsets);
level = btr_page_get_level(buf_block_get_frame(block), mtr);
level = btr_page_get_level(buf_block_get_frame(block));
if (new_rec) {
child_rec = new_rec;
......@@ -668,9 +668,8 @@ rtr_adjust_upper_level(
cursor.thr = sea_cur->thr;
/* Get the level of the split pages */
level = btr_page_get_level(buf_block_get_frame(block), mtr);
ut_ad(level
== btr_page_get_level(buf_block_get_frame(new_block), mtr));
level = btr_page_get_level(buf_block_get_frame(block));
ut_ad(level == btr_page_get_level(buf_block_get_frame(new_block)));
page = buf_block_get_frame(block);
page_no = block->page.id.page_no();
......@@ -1048,7 +1047,7 @@ rtr_page_split_and_insert(
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block);
page_level = btr_page_get_level(page, mtr);
page_level = btr_page_get_level(page);
current_ssn = page_get_ssn_id(page);
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
......
......@@ -718,7 +718,7 @@ rtr_page_get_father_node_ptr(
ut_ad(dict_index_get_page(index) != page_no);
level = btr_page_get_level(btr_cur_get_page(cursor), mtr);
level = btr_page_get_level(btr_cur_get_page(cursor));
user_rec = btr_cur_get_rec(cursor);
ut_a(page_rec_is_user_rec(user_rec));
......@@ -1680,7 +1680,7 @@ rtr_cur_search_with_match(
page = buf_block_get_frame(block);
const ulint level = btr_page_get_level(page, mtr);
const ulint level = btr_page_get_level(page);
const bool is_leaf = !level;
if (mode == PAGE_CUR_RTREE_LOCATE) {
......
......@@ -483,7 +483,7 @@ ibuf_size_update(
ibuf->free_list_len = flst_get_len(root + PAGE_HEADER
+ PAGE_BTR_IBUF_FREE_LIST);
ibuf->height = 1 + btr_page_get_level_low(root);
ibuf->height = 1 + btr_page_get_level(root);
/* the '1 +' is the ibuf header page */
ibuf->size = ibuf->seg_size - (1 + ibuf->free_list_len);
......
......@@ -288,11 +288,10 @@ Gets the node level field in an index page.
@return level, leaf level == 0 */
UNIV_INLINE
ulint
btr_page_get_level_low(
btr_page_get_level(
/*===================*/
const page_t* page) /*!< in: index page */
MY_ATTRIBUTE((warn_unused_result));
#define btr_page_get_level(page, mtr) btr_page_get_level_low(page)
/********************************************************//**
Gets the next index page number.
@return next page number */
......
......@@ -33,7 +33,7 @@ Created 6/2/1994 Heikki Tuuri
(not really a hard limit).
Used in debug assertions
in btr_page_set_level and
btr_page_get_level_low */
btr_page_get_level */
/** Gets a buffer page and declares its latching order level.
@param[in] page_id page id
......@@ -148,7 +148,7 @@ Gets the node level field in an index page.
@return level, leaf level == 0 */
UNIV_INLINE
ulint
btr_page_get_level_low(
btr_page_get_level(
/*===================*/
const page_t* page) /*!< in: index page */
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment