Use page_is_leaf() where applicable.

This commit is contained in:
Marko Mäkelä 2017-04-08 16:47:41 +03:00
parent 3849f8b2bb
commit bb81828938
4 changed files with 8 additions and 6 deletions

View file

@ -2943,7 +2943,7 @@ func_start:
btr_page_create(new_block, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr);
/* 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_modified_counter ++;
btr_defragment_save_defrag_stats_if_needed(cursor->index);

View file

@ -2175,7 +2175,7 @@ btr_cur_open_at_index_side_func(
page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED
&& btr_page_get_level(page, mtr) == 0
&& page_is_leaf(page)
&& rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page
@ -2532,7 +2532,7 @@ btr_cur_open_at_rnd_pos_func(
page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED
&& btr_page_get_level(page, mtr) == 0
&& page_is_leaf(page)
&& rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page

View file

@ -233,7 +233,9 @@ btr_defragment_add_index(
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.
mtr_commit(&mtr);
return NULL;

View file

@ -1553,7 +1553,7 @@ dict_stats_analyze_index_below_cur(
page = buf_block_get_frame(block);
if (btr_page_get_level(page, mtr) == 0) {
if (page_is_leaf(page)) {
/* leaf level */
break;
}
@ -1598,7 +1598,7 @@ dict_stats_analyze_index_below_cur(
}
/* 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,
when looking only at the first n_prefix columns; also estimate