Commit 2117ec5a authored by marko's avatar marko

branches/zip: Add page_zip_validate() assertions and remove a bogus

page_zip_assertion() failure in page_copy_rec_list_end().

btr_root_raise_and_insert(), btr_lift_page_up(), btr_compress():
Add page_zip_validate() assertions.

btr_compress(): Only copy FIL_PAGE_PREV when UNIV_BTR_DEBUG is defined.

page_cur_delete_rec(): Document why the page_zip_validate() assertion
was removed.

page_copy_rec_list_end(): Remove the page_zip_validate() assertion and
document why.

page_move_rec_list_end(): Add page_zip_validate() assertion.
parent 8f6de3bb
......@@ -1069,6 +1069,9 @@ btr_root_raise_and_insert(
root = btr_cur_get_page(cursor);
root_page_zip = buf_block_get_page_zip(buf_block_align(root));
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
tree = btr_cur_get_tree(cursor);
ut_ad(dict_tree_get_page(tree) == buf_frame_get_page_no(root));
......@@ -2132,6 +2135,10 @@ btr_lift_page_up(
father_page = buf_frame_align(
btr_page_get_father_node_ptr(tree, page, mtr));
father_page_zip = buf_block_get_page_zip(buf_block_align(father_page));
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(!father_page_zip
|| page_zip_validate(father_page_zip, father_page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
page_level = btr_page_get_level(page, mtr);
index = tree->tree_index;
......@@ -2192,6 +2199,7 @@ btr_compress(
ulint left_page_no;
ulint right_page_no;
page_t* merge_page;
page_zip_des_t* merge_page_zip;
ibool is_left;
page_t* page;
rec_t* node_ptr;
......@@ -2293,13 +2301,17 @@ btr_compress(
}
}
merge_page_zip = buf_block_get_page_zip(buf_block_align(merge_page));
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/* Move records to the merge page */
if (is_left) {
rec_t* orig_pred = page_rec_get_prev(
page_get_supremum_rec(merge_page));
if (UNIV_UNLIKELY(!page_copy_rec_list_start(
merge_page, buf_block_get_page_zip(
buf_block_align(merge_page)),
merge_page, merge_page_zip,
page_get_supremum_rec(page),
cursor->index, mtr))) {
return(FALSE);
......@@ -2317,9 +2329,9 @@ btr_compress(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* orig_succ = page_rec_get_next(
page_get_infimum_rec(merge_page));
page_zip_des_t* merge_page_zip = buf_block_get_page_zip(
buf_block_align(merge_page));
#ifdef UNIV_BTR_DEBUG
byte fil_page_prev[4];
#endif /* UNIV_BTR_DEBUG */
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
if (UNIV_LIKELY_NULL(merge_page_zip)) {
......@@ -2327,7 +2339,9 @@ btr_compress(
invoked by page_copy_rec_list_end() below,
requires that FIL_PAGE_PREV be FIL_NULL.
Clear the field, but prepare to restore it. */
#ifdef UNIV_BTR_DEBUG
memcpy(fil_page_prev, merge_page + FIL_PAGE_PREV, 4);
#endif /* UNIV_BTR_DEBUG */
#if FIL_NULL != 0xffffffff
# error "FIL_NULL != 0xffffffff"
#endif
......@@ -2339,8 +2353,7 @@ btr_compress(
page_get_infimum_rec(page),
cursor->index, mtr))) {
ut_a(merge_page_zip);
/* Restore FIL_PAGE_PREV. */
memcpy(merge_page + FIL_PAGE_PREV, fil_page_prev, 4);
/* FIL_PAGE_PREV was restored from merge_page_zip. */
return(FALSE);
}
......
......@@ -1511,6 +1511,8 @@ page_cur_delete_rec(
ut_ad(cursor && mtr);
page = page_cur_get_page(cursor);
/* page_zip_validate() may fail here when
btr_cur_pessimistic_delete() invokes btr_set_min_rec_mark(). */
current_rec = cursor->rec;
ut_ad(rec_offs_validate(current_rec, index, offsets));
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
......
......@@ -588,9 +588,8 @@ page_copy_rec_list_end(
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
ulint log_mode= 0; /* remove warning */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(!new_page_zip || page_zip_validate(new_page_zip, new_page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/* page_zip_validate() will fail here if btr_compress()
sets FIL_PAGE_PREV to FIL_NULL */
ut_ad(page_is_leaf(page) == page_is_leaf(new_page));
ut_ad(page_is_comp(page) == page_is_comp(new_page));
......@@ -1072,6 +1071,11 @@ page_move_rec_list_end(
old_data_size = page_get_data_size(new_page);
old_n_recs = page_get_n_recs(new_page);
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(!new_page_zip || page_zip_validate(new_page_zip, new_page));
ut_a(!page_zip || page_zip_validate(page_zip,
ut_align_down(split_rec, UNIV_PAGE_SIZE)));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
if (UNIV_UNLIKELY(!page_copy_rec_list_end(new_page, new_page_zip,
split_rec, index, mtr))) {
......
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