Commit bb818289 authored by Marko Mäkelä's avatar Marko Mäkelä

Use page_is_leaf() where applicable.

parent 3849f8b2
...@@ -2943,7 +2943,7 @@ btr_page_split_and_insert( ...@@ -2943,7 +2943,7 @@ btr_page_split_and_insert(
btr_page_create(new_block, new_page_zip, cursor->index, btr_page_create(new_block, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr); btr_page_get_level(page, mtr), mtr);
/* Only record the leaf level page splits. */ /* Only record the leaf level page splits. */
if (btr_page_get_level(page, mtr) == 0) { if (page_is_leaf(page)) {
cursor->index->stat_defrag_n_page_split ++; cursor->index->stat_defrag_n_page_split ++;
cursor->index->stat_defrag_modified_counter ++; cursor->index->stat_defrag_modified_counter ++;
btr_defragment_save_defrag_stats_if_needed(cursor->index); btr_defragment_save_defrag_stats_if_needed(cursor->index);
......
...@@ -2175,7 +2175,7 @@ btr_cur_open_at_index_side_func( ...@@ -2175,7 +2175,7 @@ btr_cur_open_at_index_side_func(
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED if (height == ULINT_UNDEFINED
&& btr_page_get_level(page, mtr) == 0 && page_is_leaf(page)
&& rw_latch != RW_NO_LATCH && rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) { && rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page /* We should retry to get the page, because the root page
...@@ -2532,7 +2532,7 @@ btr_cur_open_at_rnd_pos_func( ...@@ -2532,7 +2532,7 @@ btr_cur_open_at_rnd_pos_func(
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED if (height == ULINT_UNDEFINED
&& btr_page_get_level(page, mtr) == 0 && page_is_leaf(page)
&& rw_latch != RW_NO_LATCH && rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) { && rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page /* We should retry to get the page, because the root page
......
...@@ -233,7 +233,9 @@ btr_defragment_add_index( ...@@ -233,7 +233,9 @@ btr_defragment_add_index(
return NULL; return NULL;
} }
if (btr_page_get_level(page, &mtr) == 0) { ut_ad(page_is_root(page));
if (page_is_leaf(page)) {
// Index root is a leaf page, no need to defragment. // Index root is a leaf page, no need to defragment.
mtr_commit(&mtr); mtr_commit(&mtr);
return NULL; return NULL;
......
...@@ -1553,7 +1553,7 @@ dict_stats_analyze_index_below_cur( ...@@ -1553,7 +1553,7 @@ dict_stats_analyze_index_below_cur(
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
if (btr_page_get_level(page, mtr) == 0) { if (page_is_leaf(page)) {
/* leaf level */ /* leaf level */
break; break;
} }
...@@ -1598,7 +1598,7 @@ dict_stats_analyze_index_below_cur( ...@@ -1598,7 +1598,7 @@ dict_stats_analyze_index_below_cur(
} }
/* make sure we got a leaf page as a result from the above loop */ /* make sure we got a leaf page as a result from the above loop */
ut_ad(btr_page_get_level(page, &mtr) == 0); ut_ad(page_is_leaf(page));
/* scan the leaf page and find the number of distinct keys, /* scan the leaf page and find the number of distinct keys,
when looking only at the first n_prefix columns; also estimate when looking only at the first n_prefix columns; also estimate
......
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