Commit a3cc71e0 authored by marko's avatar marko

branches/zip: Improve page_zip_validate() instrumentation.

btr_lift_page_up(): Invoke page_zip_validate() on every page whose level
is adjusted.

btr_compress(): Invoke page_zip_validate() on merge_page at the end.

page_zip_copy_recs(): Relax the page_zip_validate(...) to
page_zip_validate_low(..., sloppy = TRUE) to avoid bogus assertion failures.

page_copy_rec_list_end(), page_delete_rec_list_start():
Invoke page_zip_validate_low(sloppy = TRUE).
parent d3deb635
...@@ -2348,11 +2348,14 @@ btr_lift_page_up( ...@@ -2348,11 +2348,14 @@ btr_lift_page_up(
/* Go upward to root page, decrementing levels by one. */ /* Go upward to root page, decrementing levels by one. */
for (i = 0; i < n_blocks; i++, page_level++) { for (i = 0; i < n_blocks; i++, page_level++) {
page_t* page = buf_block_get_frame(blocks[i]); page_t* page = buf_block_get_frame(blocks[i]);
page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]);
ut_ad(btr_page_get_level(page, mtr) == page_level + 1); ut_ad(btr_page_get_level(page, mtr) == page_level + 1);
btr_page_set_level(page, buf_block_get_page_zip(blocks[i]), btr_page_set_level(page, page_zip, page_level, mtr);
page_level, mtr); #ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
} }
/* Free the file page */ /* Free the file page */
...@@ -2647,6 +2650,9 @@ err_exit: ...@@ -2647,6 +2650,9 @@ err_exit:
} }
ut_ad(page_validate(merge_page, index)); ut_ad(page_validate(merge_page, index));
#ifdef UNIV_ZIP_DEBUG
ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page));
#endif /* UNIV_ZIP_DEBUG */
/* Free the file page */ /* Free the file page */
btr_page_free(index, block, mtr); btr_page_free(index, block, mtr);
......
...@@ -593,8 +593,17 @@ page_copy_rec_list_end( ...@@ -593,8 +593,17 @@ page_copy_rec_list_end(
page_get_infimum_rec(new_page)); page_get_infimum_rec(new_page));
ulint log_mode = 0; /* remove warning */ ulint log_mode = 0; /* remove warning */
/* page_zip_validate() will fail here if btr_compress() #ifdef UNIV_ZIP_DEBUG
if (new_page_zip) {
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
ut_a(page_zip);
/* page_zip_validate() may fail here if btr_compress()
sets FIL_PAGE_PREV to FIL_NULL */ sets FIL_PAGE_PREV to FIL_NULL */
ut_a(page_zip_validate_low(new_page_zip, new_page, TRUE));
ut_a(page_zip_validate_low(page_zip, page, TRUE));
}
#endif /* UNIV_ZIP_DEBUG */
ut_ad(buf_block_get_frame(block) == page); ut_ad(buf_block_get_frame(block) == page);
ut_ad(page_is_leaf(page) == page_is_leaf(new_page)); ut_ad(page_is_leaf(page) == page_is_leaf(new_page));
ut_ad(page_is_comp(page) == page_is_comp(new_page)); ut_ad(page_is_comp(page) == page_is_comp(new_page));
...@@ -1057,10 +1066,19 @@ page_delete_rec_list_start( ...@@ -1057,10 +1066,19 @@ page_delete_rec_list_start(
ut_ad((ibool) !!page_rec_is_comp(rec) ut_ad((ibool) !!page_rec_is_comp(rec)
== dict_table_is_comp(index->table)); == dict_table_is_comp(index->table));
#ifdef UNIV_ZIP_DEBUG
{
page_zip_des_t* page_zip= buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
/* page_zip_validate() would detect a min_rec_mark mismatch /* page_zip_validate() would detect a min_rec_mark mismatch
in btr_page_split_and_insert() in btr_page_split_and_insert()
between btr_attach_half_pages() and insert_page = ... between btr_attach_half_pages() and insert_page = ...
when btr_page_get_split_rec_to_left() holds (direction == FSP_DOWN). */ when btr_page_get_split_rec_to_left() holds
(direction == FSP_DOWN). */
ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE));
}
#endif /* UNIV_ZIP_DEBUG */
if (page_rec_is_infimum(rec)) { if (page_rec_is_infimum(rec)) {
......
...@@ -4404,7 +4404,11 @@ page_zip_copy_recs( ...@@ -4404,7 +4404,11 @@ page_zip_copy_recs(
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(mtr, (page_t*) src, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, (page_t*) src, MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(src_zip, src)); /* The B-tree operations that call this function may set
FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag
mismatch. A strict page_zip_validate() will be executed later
during the B-tree operations. */
ut_a(page_zip_validate_low(src_zip, src, TRUE));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip));
if (UNIV_UNLIKELY(src_zip->n_blobs)) { if (UNIV_UNLIKELY(src_zip->n_blobs)) {
......
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