Commit 9c7913d9 authored by marko's avatar marko

branches/zip: btr_compress(): When merging a compressed page to the right,

set the FIL_PAGE_PREV field of merge_page to FIL_NULL before copying the
records in order not to break the assumption of page_zip_compress() that
min_rec_mark is always set on the first user record of a non-leaf page
whose FIL_PAGE_PREV field is FIL_NULL, and never otherwise.
parent 1d406a01
...@@ -2283,18 +2283,47 @@ btr_compress( ...@@ -2283,18 +2283,47 @@ btr_compress(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* orig_succ = page_rec_get_next( rec_t* orig_succ = page_rec_get_next(
page_get_infimum_rec(merge_page)); page_get_infimum_rec(merge_page));
page_zip_des_t* merge_page_zip = buf_block_get_page_zip(
buf_block_align(merge_page));
byte fil_page_prev[4];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
if (UNIV_LIKELY_NULL(merge_page_zip)) {
/* The function page_zip_compress(), which will be
invoked by page_copy_rec_list_end() below,
requires that FIL_PAGE_PREV be FIL_NULL.
Clear the field, but prepare to restore it. */
memcpy(fil_page_prev, merge_page + FIL_PAGE_PREV, 4);
#if FIL_NULL != 0xffffffff
# error "FIL_NULL != 0xffffffff"
#endif
memset(merge_page + FIL_PAGE_PREV, 0xff, 4);
}
if (UNIV_UNLIKELY(!page_copy_rec_list_end( if (UNIV_UNLIKELY(!page_copy_rec_list_end(
merge_page, buf_block_get_page_zip( merge_page, merge_page_zip,
buf_block_align(merge_page)),
page_get_infimum_rec(page), page_get_infimum_rec(page),
cursor->index, mtr))) { cursor->index, mtr))) {
ut_a(merge_page_zip);
/* Restore FIL_PAGE_PREV. */
memcpy(merge_page + FIL_PAGE_PREV, fil_page_prev, 4);
return(FALSE); return(FALSE);
} }
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
#ifdef UNIV_BTR_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) {
/* Restore FIL_PAGE_PREV in order to avoid an assertion
failure in btr_level_list_remove(), which will set
the field again to FIL_NULL. Even though this makes
merge_page and merge_page_zip inconsistent for a
split second, it is harmless, because the pages
are X-latched. */
memcpy(merge_page + FIL_PAGE_PREV, fil_page_prev, 4);
}
#endif /* UNIV_BTR_DEBUG */
/* Remove the page from the level list */ /* Remove the page from the level list */
btr_level_list_remove(tree, page, mtr); btr_level_list_remove(tree, page, 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