Commit 82c74a75 authored by marko's avatar marko

branches/zip: Minor improvements for debugging and testing purposes.

buf_flush_init_for_writing(): Improve the diagnostics and make the
condition for skipping pages accurate.

univ.i: Introduce UNIV_ZIP_DEBUG for enabling some page_zip_validate() tests.

page0zip.h, page0zip.c: Define and use page_zip_validate() in
page_zip_compress() and page_zip_write() if UNIV_ZIP_DEBUG or UNIV_DEBUG
is defined.
parent fe9e164f
......@@ -480,8 +480,8 @@ buf_flush_init_for_writing(
buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
#if 1 /* testing */
if (space /* skip the system tablespace */
&& (page_no & (UNIV_PAGE_SIZE - 1)) /* skip extent descriptors */
&& page_is_comp(page) /* skip row_format=redundant pages */) {
&& page_no != FSP_FIRST_INODE_PAGE_NO
&& page_no % XDES_DESCRIBED_PER_PAGE > FSP_IBUF_BITMAP_OFFSET) {
if (memcmp(page + PAGE_NEW_INFIMUM, "infimum", 8)) {
fprintf(stderr, "page %lu:%lu: cannot compress\n",
(ulong) space, (ulong) page_no);
......@@ -495,8 +495,11 @@ buf_flush_init_for_writing(
ut_a(page_zip_compress(page_zip, page));
fprintf(stderr, "page %lu:%lu: zip size==%lu+%lu\n",
fprintf(stderr,
"page %lu:%lu (%lu): zip size==%lu+%lu\n",
(ulong) space, (ulong) page_no,
(ulong) mach_read_from_2(page
+ (PAGE_HEADER + PAGE_LEVEL)),
(ulong) page_zip->m_start,
(ulong) 2
* page_dir_get_n_heap(page_zip->data));
......
......@@ -62,7 +62,9 @@ page_zip_simple_validate(
/* out: TRUE if ok */
const page_zip_des_t* page_zip); /* in: compressed page
descriptor */
#endif /* UNIV_DEBUG */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/**************************************************************************
Check that the compressed and decompressed pages match. */
......@@ -71,7 +73,7 @@ page_zip_validate(
/*==============*/
const page_zip_des_t* page_zip,/* in: compressed page */
const page_t* page); /* in: uncompressed page */
#endif /* UNIV_DEBUG */
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory). */
......
......@@ -93,6 +93,7 @@ some consistency checks to code. They use a little CPU time. */
#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
#define UNIV_SRV_PRINT_LATCH_WAITS;
#define UNIV_ZIP_DEBUG
*/
#define UNIV_LIGHT_MEM_DEBUG
......
......@@ -259,7 +259,9 @@ page_zip_compress(
memset(page_zip->data + PAGE_DATA + c_stream.total_out, 0,
c_stream.avail_out + 1);
mem_heap_free(heap);
ut_ad(page_zip_validate(page_zip, page));
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
return(TRUE);
}
......@@ -740,7 +742,7 @@ page_zip_decompress(
return(TRUE);
}
#ifdef UNIV_DEBUG
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/**************************************************************************
Check that the compressed and decompressed pages match. */
......@@ -763,7 +765,7 @@ page_zip_validate(
buf_frame_free(temp_page);
return(valid);
}
#endif /* UNIV_DEBUG */
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/**************************************************************************
Write data to the compressed portion of a page. The data must already
......@@ -806,8 +808,10 @@ page_zip_write(
page_zip->m_end += length;
ut_ad(!page_zip->data[page_zip->m_end]);
ut_ad(page_zip->m_end + trailer_len < page_zip->size);
ut_ad(page_zip_validate(page_zip,
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip,
ut_align_down((byte*) str, UNIV_PAGE_SIZE)));
#endif /* UNIV_DEBUG || 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