Commit 082f28dc authored by marko's avatar marko

branches/zip: Relax the page_zip_validate() check during crash recovery:

ignore intermittent differences in the "predefined minimum record" flag.

page_zip_validate_low(): Renamed from page_zip_validate(), with an
additional parameter: ibool sloppy.  Ignore REC_INFO_MIN_REC_FLAG when
sloppy == TRUE.

page_zip_validate(): Wrapper for page_zip_validate_low().  Pass
sloppy = recv_recovery_is_on().

recv_recover_page(): After applying the changes from the redo log to a
compressed B-tree page, invoke page_zip_validate_low() in strict mode.
parent cefd498e
......@@ -128,6 +128,18 @@ page_zip_simple_validate(
Check that the compressed and decompressed pages match. */
UNIV_INTERN
ibool
page_zip_validate_low(
/*==================*/
/* out: TRUE if valid, FALSE if not */
const page_zip_des_t* page_zip,/* in: compressed page */
const page_t* page, /* in: uncompressed page */
ibool sloppy) /* in: FALSE=strict,
TRUE=ignore the MIN_REC_FLAG */
__attribute__((nonnull));
/**************************************************************************
Check that the compressed and decompressed pages match. */
UNIV_INTERN
ibool
page_zip_validate(
/*==============*/
const page_zip_des_t* page_zip,/* in: compressed page */
......
......@@ -1341,6 +1341,16 @@ recv_recover_page(
recv = UT_LIST_GET_NEXT(rec_list, recv);
}
#ifdef UNIV_ZIP_DEBUG
if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
if (page_zip) {
ut_a(page_zip_validate_low(page_zip, page, FALSE));
}
}
#endif /* UNIV_ZIP_DEBUG */
mutex_enter(&(recv_sys->mutex));
if (recv_max_page_lsn < page_lsn) {
......
......@@ -2991,11 +2991,13 @@ UNIV_INTERN ibool page_zip_validate_header_only = FALSE;
Check that the compressed and decompressed pages match. */
UNIV_INTERN
ibool
page_zip_validate(
/*==============*/
page_zip_validate_low(
/*==================*/
/* out: TRUE if valid, FALSE if not */
const page_zip_des_t* page_zip,/* in: compressed page */
const page_t* page) /* in: uncompressed page */
const page_t* page, /* in: uncompressed page */
ibool sloppy) /* in: FALSE=strict,
TRUE=ignore the MIN_REC_FLAG */
{
page_zip_des_t temp_page_zip;
byte* temp_page_buf;
......@@ -3070,6 +3072,36 @@ page_zip_validate(
}
if (memcmp(page + PAGE_HEADER, temp_page + PAGE_HEADER,
UNIV_PAGE_SIZE - PAGE_HEADER - FIL_PAGE_DATA_END)) {
/* In crash recovery, the "minimum record" flag may be
set incorrectly until the mini-transaction is
committed. Let us tolerate that difference when we
are performing a sloppy validation. */
if (sloppy) {
byte info_bits_diff;
ulint offset
= rec_get_next_offs(page + PAGE_NEW_INFIMUM,
TRUE);
ut_a(offset >= PAGE_NEW_SUPREMUM);
offset -= 5 /* REC_NEW_INFO_BITS */;
info_bits_diff = page[offset] ^ temp_page[offset];
if (info_bits_diff == REC_INFO_MIN_REC_FLAG) {
temp_page[offset] = page[offset];
if (!memcmp(page + PAGE_HEADER,
temp_page + PAGE_HEADER,
UNIV_PAGE_SIZE - PAGE_HEADER
- FIL_PAGE_DATA_END)) {
/* Only the minimum record flag
differed. Let us ignore it. */
goto func_exit;
}
}
}
page_zip_fail(("page_zip_validate: content\n"));
valid = FALSE;
}
......@@ -3084,6 +3116,20 @@ func_exit:
ut_free(temp_page_buf);
return(valid);
}
/**************************************************************************
Check that the compressed and decompressed pages match. */
UNIV_INTERN
ibool
page_zip_validate(
/*==============*/
/* out: TRUE if valid, FALSE if not */
const page_zip_des_t* page_zip,/* in: compressed page */
const page_t* page) /* in: uncompressed page */
{
return(page_zip_validate_low(page_zip, page,
recv_recovery_is_on()));
}
#endif /* UNIV_ZIP_DEBUG */
#ifdef UNIV_DEBUG
......
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