Commit 81f7884d authored by marko's avatar marko

branches/zip: Improve debugging.

page_zip_decompress(): Move the function body to page_zip_decompress_low(),
add the parameter do_validate() to enable page_validate() assertion.  Wrap
page_zip_decompress_low() with do_validate=TRUE.

page_zip_validate(): Invoke page_zip_decompress_low() with do_validate=FALSE,
as page_validate() may fail when the compressed page is being updated
in-place.

page_dir_slot_check(): Replace buf_frame_align() with ut_align_down()
in order to avoid an assertion failure in page_zip_validate(), which
will now invoke page_validate() via page_zip_decompress().
parent a9792eeb
......@@ -154,7 +154,7 @@ page_dir_slot_check(
ut_a(slot);
page = buf_frame_align(slot);
page = ut_align_down(slot, UNIV_PAGE_SIZE);
n_slots = page_dir_get_n_slots(page);
......
......@@ -1515,14 +1515,16 @@ page_zip_apply_log(
Decompress a page. This function should tolerate errors on the compressed
page. Instead of letting assertions fail, it will return FALSE if an
inconsistency is detected. */
static
ibool
page_zip_decompress(
/*================*/
page_zip_decompress_low(
/*====================*/
/* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size;
out: m_start, m_end, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */
page_t* page, /* out: uncompressed page, may be trashed */
ibool do_validate __attribute__((unused)))
/* in: TRUE=assert page_validate() */
{
z_stream d_stream;
dict_index_t* index = NULL;
......@@ -1973,7 +1975,7 @@ page_zip_decompress(
recs_done:
ut_a(page_is_comp(page));
ut_ad(page_simple_validate_new(page));
ut_ad(!do_validate || page_validate(page, index));
page_zip_fields_free(index);
mem_heap_free(heap);
......@@ -1981,6 +1983,22 @@ page_zip_decompress(
return(TRUE);
}
/**************************************************************************
Decompress a page. This function should tolerate errors on the compressed
page. Instead of letting assertions fail, it will return FALSE if an
inconsistency is detected. */
ibool
page_zip_decompress(
/*================*/
/* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size;
out: m_start, m_end, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */
{
return(page_zip_decompress_low(page_zip, page, TRUE));
}
#ifdef UNIV_ZIP_DEBUG
/* Flag: make page_zip_validate() compare page headers only */
ibool page_zip_validate_header_only = FALSE;
......@@ -2022,7 +2040,7 @@ page_zip_validate(
temp_page_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
temp_page = ut_align(temp_page_buf, UNIV_PAGE_SIZE);
valid = page_zip_decompress(&temp_page_zip, temp_page);
valid = page_zip_decompress_low(&temp_page_zip, temp_page, FALSE);
if (!valid) {
fputs("page_zip_validate(): failed to decompress\n", stderr);
goto func_exit;
......
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