Commit 66088021 authored by marko's avatar marko

branches/zip: Remove page_zip_decompress_low(). Do not call page_validate()

on the ZIP_DUMMY index.  Because it does not contain valid collation
information, the ordering check in page_validate() may fail on pages
containing non-binary data.

Instead, let the callers of page_zip_decompress() invoke page_validate()
when the index information is available.
parent 68a65c14
...@@ -1160,6 +1160,7 @@ page_cur_insert_rec_low( ...@@ -1160,6 +1160,7 @@ page_cur_insert_rec_low(
if (!page_zip_decompress(page_zip_orig, page)) { if (!page_zip_decompress(page_zip_orig, page)) {
ut_error; /* Memory corrupted? */ ut_error; /* Memory corrupted? */
} }
ut_ad(page_validate(page, index));
return(NULL); return(NULL);
} }
......
...@@ -620,6 +620,7 @@ page_copy_rec_list_end( ...@@ -620,6 +620,7 @@ page_copy_rec_list_end(
new_page))) { new_page))) {
ut_error; ut_error;
} }
ut_ad(page_validate(new_page, index));
return(NULL); return(NULL);
} else { } else {
/* The page was reorganized: /* The page was reorganized:
...@@ -729,7 +730,7 @@ page_copy_rec_list_start( ...@@ -729,7 +730,7 @@ page_copy_rec_list_start(
new_page))) { new_page))) {
ut_error; ut_error;
} }
ut_ad(page_validate(new_page, index));
return(NULL); return(NULL);
} else { } else {
/* The page was reorganized: /* The page was reorganized:
......
...@@ -1544,16 +1544,14 @@ page_zip_apply_log( ...@@ -1544,16 +1544,14 @@ page_zip_apply_log(
Decompress a page. This function should tolerate errors on the compressed Decompress a page. This function should tolerate errors on the compressed
page. Instead of letting assertions fail, it will return FALSE if an page. Instead of letting assertions fail, it will return FALSE if an
inconsistency is detected. */ inconsistency is detected. */
static
ibool ibool
page_zip_decompress_low( page_zip_decompress(
/*====================*/ /*================*/
/* out: TRUE on success, FALSE on failure */ /* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size; page_zip_des_t* page_zip,/* in: data, size;
out: m_start, m_end, n_blobs */ 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; z_stream d_stream;
dict_index_t* index = NULL; dict_index_t* index = NULL;
...@@ -2015,7 +2013,6 @@ page_zip_decompress_low( ...@@ -2015,7 +2013,6 @@ page_zip_decompress_low(
recs_done: recs_done:
ut_a(page_is_comp(page)); ut_a(page_is_comp(page));
ut_ad(!do_validate || page_validate(page, index));
page_zip_fields_free(index); page_zip_fields_free(index);
mem_heap_free(heap); mem_heap_free(heap);
...@@ -2023,22 +2020,6 @@ page_zip_decompress_low( ...@@ -2023,22 +2020,6 @@ page_zip_decompress_low(
return(TRUE); 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 #ifdef UNIV_ZIP_DEBUG
/* Flag: make page_zip_validate() compare page headers only */ /* Flag: make page_zip_validate() compare page headers only */
ibool page_zip_validate_header_only = FALSE; ibool page_zip_validate_header_only = FALSE;
...@@ -2080,7 +2061,7 @@ page_zip_validate( ...@@ -2080,7 +2061,7 @@ page_zip_validate(
temp_page_buf = ut_malloc(2 * UNIV_PAGE_SIZE); temp_page_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
temp_page = ut_align(temp_page_buf, UNIV_PAGE_SIZE); temp_page = ut_align(temp_page_buf, UNIV_PAGE_SIZE);
valid = page_zip_decompress_low(&temp_page_zip, temp_page, FALSE); valid = page_zip_decompress(&temp_page_zip, temp_page);
if (!valid) { if (!valid) {
fputs("page_zip_validate(): failed to decompress\n", stderr); fputs("page_zip_validate(): failed to decompress\n", stderr);
goto func_exit; 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