Commit 24dce67d authored by marko's avatar marko

branches/zip: Merge revisions 558:560 from trunk.

parent e47742cb
......@@ -183,6 +183,10 @@ btr_get_prev_user_rec(
|| (mtr_memo_contains(mtr, buf_block_align(prev_page),
MTR_MEMO_PAGE_X_FIX)));
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
return(page_rec_get_prev(page_get_supremum_rec(prev_page)));
}
......@@ -230,6 +234,10 @@ btr_get_next_user_rec(
MTR_MEMO_PAGE_S_FIX))
|| (mtr_memo_contains(mtr, buf_block_align(next_page),
MTR_MEMO_PAGE_X_FIX)));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(next_page) == page_is_comp(page));
return(page_rec_get_next(page_get_infimum_rec(next_page)));
......@@ -1627,6 +1635,10 @@ btr_attach_half_pages(
prev_page = btr_page_get(space, prev_page_no, RW_X_LATCH, mtr);
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, buf_block_get_page_zip(
buf_block_align(prev_page)),
......@@ -1941,6 +1953,10 @@ btr_level_list_remove(
prev_page = btr_page_get(space, prev_page_no, RW_X_LATCH, mtr);
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, buf_block_get_page_zip(
buf_block_align(prev_page)),
......@@ -1951,6 +1967,10 @@ btr_level_list_remove(
next_page = btr_page_get(space, next_page_no, RW_X_LATCH, mtr);
ut_a(page_is_comp(next_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_prev(next_page, buf_block_get_page_zip(
buf_block_align(next_page)),
......@@ -2190,10 +2210,18 @@ btr_compress(
merge_page = btr_page_get(space, left_page_no, RW_X_LATCH,
mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) {
merge_page = btr_page_get(space, right_page_no, RW_X_LATCH,
mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else {
/* The page is the only one on the level, lift the records
to the father */
......@@ -2396,9 +2424,17 @@ btr_discard_page(
if (left_page_no != FIL_NULL) {
merge_page = btr_page_get(space, left_page_no, RW_X_LATCH,
mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) {
merge_page = btr_page_get(space, right_page_no, RW_X_LATCH,
mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else {
btr_discard_only_page_on_level(tree, page, mtr);
......@@ -2923,7 +2959,29 @@ loop:
rec_t* right_rec;
right_page = btr_page_get(space, right_page_no, RW_X_LATCH,
&mtr);
ut_a(page_is_comp(right_page) == page_is_comp(page));
if (UNIV_UNLIKELY(btr_page_get_prev(right_page, &mtr)
!= buf_frame_get_page_no(page))) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: broken FIL_PAGE_NEXT"
" or FIL_PAGE_PREV links\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
ret = FALSE;
}
if (UNIV_UNLIKELY(page_is_comp(right_page)
!= page_is_comp(page))) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
ret = FALSE;
goto node_ptr_fails;
}
rec = page_rec_get_prev(page_get_supremum_rec(page));
right_rec = page_rec_get_next(
page_get_infimum_rec(right_page));
......@@ -2931,8 +2989,8 @@ loop:
offsets, ULINT_UNDEFINED, &heap);
offsets2 = rec_get_offsets(right_rec, index,
offsets2, ULINT_UNDEFINED, &heap);
if (cmp_rec_rec(rec, right_rec, offsets, offsets2, index)
>= 0) {
if (UNIV_UNLIKELY(cmp_rec_rec(rec, right_rec,
offsets, offsets2, index) >= 0)) {
btr_validate_report2(index, level, page, right_page);
......@@ -3048,10 +3106,7 @@ loop:
ut_a(node_ptr == page_rec_get_prev(
page_get_supremum_rec(father_page)));
ut_a(btr_page_get_next(father_page, &mtr) == FIL_NULL);
}
if (right_page_no != FIL_NULL) {
} else {
right_node_ptr = btr_page_get_father_node_ptr(tree,
right_page, &mtr);
if (page_rec_get_next(node_ptr) !=
......@@ -3113,14 +3168,15 @@ loop:
}
node_ptr_fails:
/* Commit the mini-transaction to release the latch on 'page'.
Re-acquire the latch on right_page, which will become 'page'
on the next loop. The page has already been checked. */
mtr_commit(&mtr);
if (right_page_no != FIL_NULL) {
ulint comp = page_is_comp(page);
mtr_start(&mtr);
page = btr_page_get(space, right_page_no, RW_X_LATCH, &mtr);
ut_a(page_is_comp(page) == comp);
goto loop;
}
......
......@@ -202,6 +202,10 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
get_page = btr_page_get(space, left_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(get_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush =
TRUE;
......@@ -216,6 +220,10 @@ btr_cur_latch_leaves(
if (right_page_no != FIL_NULL) {
get_page = btr_page_get(space, right_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(get_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
buf_block_align(get_page)->check_index_page_at_flush =
TRUE;
}
......@@ -228,6 +236,10 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
RW_S_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ==
page_is_comp(page));
buf_block_align(
......@@ -246,6 +258,10 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ==
page_is_comp(page));
buf_block_align(
......@@ -1880,6 +1896,10 @@ btr_cur_pess_upd_restore_supremum(
ut_ad(prev_page_no != FIL_NULL);
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
/* We must already have an x-latch to prev_page! */
ut_ad(mtr_memo_contains(mtr, buf_block_align(prev_page),
......
......@@ -397,6 +397,9 @@ btr_pcur_move_to_next_page(
ut_ad(next_page_no != FIL_NULL);
next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr) == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(next_page) == page_is_comp(page));
buf_block_align(next_page)->check_index_page_at_flush = TRUE;
......
......@@ -2345,6 +2345,10 @@ ibuf_get_volume_buffered(
}
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(prev_page, SYNC_TREE_NODE);
......@@ -2408,6 +2412,10 @@ count_later:
}
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(next_page, SYNC_TREE_NODE);
......
......@@ -94,6 +94,7 @@ memory is read outside the allocated blocks. */
#define UNIV_ZIP_DEBUG
#endif
#define UNIV_BTR_DEBUG
#define UNIV_LIGHT_MEM_DEBUG
#define YYDEBUG 1
......
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