Commit ab0456cb authored by marko's avatar marko

branches/zip: btr_cur_t: replace left_page with left_block, to avoid

calling buf_block_align() in btr_pcur_move_backward_from_page().
Also, enclose some assertions about page_is_comp() in #ifdef UNIV_BTR_DEBUG.
parent c659b59a
...@@ -188,7 +188,9 @@ btr_cur_latch_leaves( ...@@ -188,7 +188,9 @@ btr_cur_latch_leaves(
case BTR_MODIFY_LEAF: case BTR_MODIFY_LEAF:
mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH; mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH;
get_block = btr_block_get(space, page_no, mode, mtr); get_block = btr_block_get(space, page_no, mode, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE; get_block->check_index_page_at_flush = TRUE;
return; return;
case BTR_MODIFY_TREE: case BTR_MODIFY_TREE:
...@@ -208,7 +210,9 @@ btr_cur_latch_leaves( ...@@ -208,7 +210,9 @@ btr_cur_latch_leaves(
} }
get_block = btr_block_get(space, page_no, RW_X_LATCH, mtr); get_block = btr_block_get(space, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE; get_block->check_index_page_at_flush = TRUE;
right_page_no = btr_page_get_next(page, mtr); right_page_no = btr_page_get_next(page, mtr);
...@@ -236,18 +240,20 @@ btr_cur_latch_leaves( ...@@ -236,18 +240,20 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) { if (left_page_no != FIL_NULL) {
get_block = btr_block_get(space, left_page_no, get_block = btr_block_get(space, left_page_no,
mode, mtr); mode, mtr);
cursor->left_page = buf_block_get_frame(get_block); cursor->left_block = get_block;
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(cursor->left_page) ut_a(page_is_comp(get_block->frame)
== page_is_comp(page)); == page_is_comp(page));
ut_a(btr_page_get_next(cursor->left_page, mtr) ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page)); == page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE; get_block->check_index_page_at_flush = TRUE;
} }
get_block = btr_block_get(space, page_no, mode, mtr); get_block = btr_block_get(space, page_no, mode, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE; get_block->check_index_page_at_flush = TRUE;
return; return;
} }
...@@ -281,7 +287,7 @@ btr_cur_search_to_nth_level( ...@@ -281,7 +287,7 @@ btr_cur_search_to_nth_level(
PAGE_CUR_LE to search the position! */ PAGE_CUR_LE to search the position! */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ..., ORed with ulint latch_mode, /* in: BTR_SEARCH_LEAF, ..., ORed with
BTR_INSERT and BTR_ESTIMATE; BTR_INSERT and BTR_ESTIMATE;
cursor->left_page is used to store a pointer cursor->left_block is used to store a pointer
to the left neighbor page, in the cases to the left neighbor page, in the cases
BTR_SEARCH_PREV and BTR_MODIFY_PREV; BTR_SEARCH_PREV and BTR_MODIFY_PREV;
NOTE that if has_search_latch NOTE that if has_search_latch
......
...@@ -431,12 +431,12 @@ btr_pcur_move_backward_from_page( ...@@ -431,12 +431,12 @@ btr_pcur_move_backward_from_page(
record of the current page */ record of the current page */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint prev_page_no; ulint prev_page_no;
ulint space; ulint space;
page_t* page; page_t* page;
page_t* prev_page; buf_block_t* prev_block;
ulint latch_mode; ulint latch_mode;
ulint latch_mode2; ulint latch_mode2;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
...@@ -473,14 +473,13 @@ btr_pcur_move_backward_from_page( ...@@ -473,14 +473,13 @@ btr_pcur_move_backward_from_page(
if (prev_page_no == FIL_NULL) { if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor, mtr)) { } else if (btr_pcur_is_before_first_on_page(cursor, mtr)) {
prev_page = btr_pcur_get_btr_cur(cursor)->left_page; prev_block = btr_pcur_get_btr_cur(cursor)->left_block;
btr_leaf_page_release(btr_pcur_get_block(cursor), btr_leaf_page_release(btr_pcur_get_block(cursor),
latch_mode, mtr); latch_mode, mtr);
btr_pcur_get_btr_cur(cursor)->page_block btr_pcur_get_btr_cur(cursor)->page_block = prev_block;
= buf_block_align(prev_page); page_cur_set_after_last(buf_block_get_frame(prev_block),
page_cur_set_after_last(prev_page,
btr_pcur_get_page_cur(cursor)); btr_pcur_get_page_cur(cursor));
} else { } else {
...@@ -488,10 +487,9 @@ btr_pcur_move_backward_from_page( ...@@ -488,10 +487,9 @@ btr_pcur_move_backward_from_page(
a page. Cursor repositioning acquired a latch also on the a page. Cursor repositioning acquired a latch also on the
previous page, but we do not need the latch: release it. */ previous page, but we do not need the latch: release it. */
prev_page = btr_pcur_get_btr_cur(cursor)->left_page; prev_block = btr_pcur_get_btr_cur(cursor)->left_block;
btr_leaf_page_release(buf_block_align(prev_page), btr_leaf_page_release(prev_block, latch_mode, mtr);
latch_mode, mtr);
} }
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
......
...@@ -118,7 +118,7 @@ btr_cur_search_to_nth_level( ...@@ -118,7 +118,7 @@ btr_cur_search_to_nth_level(
search the position! */ search the position! */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ..., ORed with ulint latch_mode, /* in: BTR_SEARCH_LEAF, ..., ORed with
BTR_INSERT and BTR_ESTIMATE; BTR_INSERT and BTR_ESTIMATE;
cursor->left_page is used to store a pointer cursor->left_block is used to store a pointer
to the left neighbor page, in the cases to the left neighbor page, in the cases
BTR_SEARCH_PREV and BTR_MODIFY_PREV; BTR_SEARCH_PREV and BTR_MODIFY_PREV;
NOTE that if has_search_latch NOTE that if has_search_latch
...@@ -598,7 +598,7 @@ struct btr_cur_struct { ...@@ -598,7 +598,7 @@ struct btr_cur_struct {
buf_block_t* page_block; /* buffer pool block were buf_block_t* page_block; /* buffer pool block were
cursor is positioned; needed cursor is positioned; needed
to avoid buf_block_align() */ to avoid buf_block_align() */
page_t* left_page; /* this field is used to store buf_block_t* left_block; /* this field is used to store
a pointer to the left neighbor a pointer to the left neighbor
page, in the cases page, in the cases
BTR_SEARCH_PREV and BTR_SEARCH_PREV and
......
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