Commit 13002bdf authored by marko's avatar marko

branches/zip: Minor fixes. Compression/decompression still fails.

buf0flu.c: Allocate the temporary buffer from buf_frame_alloc().

page_zip_simple_validate(): Do not assert page_zip->m_start >= PAGE_DATA.

page_zip_compress(): Replace some assertions with page_zip_simple_validate(),
and do not assert anything about page_zip->data contents.

page_zip_validate(): Do not compare the page trailer bytes.

page_zip_write(): Assert that the entire page headers match and
that page_zip->m_start >= PAGE_DATA.
parent 48a1ffa5
...@@ -455,8 +455,7 @@ buf_flush_init_for_writing( ...@@ -455,8 +455,7 @@ buf_flush_init_for_writing(
ulint page_no) /* in: page number */ ulint page_no) /* in: page number */
{ {
#if 1 /* testing */ #if 1 /* testing */
byte zip[16384]; page_zip_des_t page_zip = { buf_frame_alloc(), UNIV_PAGE_SIZE, 0, 0 };
page_zip_des_t page_zip = { zip, sizeof zip, 0, 0 };
#endif /* testing */ #endif /* testing */
/* Write the newest modification lsn to the page header and trailer */ /* Write the newest modification lsn to the page header and trailer */
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn); mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
...@@ -485,7 +484,9 @@ buf_flush_init_for_writing( ...@@ -485,7 +484,9 @@ buf_flush_init_for_writing(
#if 1 /* testing */ #if 1 /* testing */
if (page_is_comp(page)) { if (page_is_comp(page)) {
ut_a(page_zip_compress(&page_zip, page)); ut_a(page_zip_compress(&page_zip, page));
fprintf(stderr, "page_zip.size==%lu\n", (ulong) page_zip.size);
} }
buf_frame_free(page_zip.data);
#endif /* testing */ #endif /* testing */
} }
......
...@@ -126,7 +126,6 @@ page_zip_simple_validate( ...@@ -126,7 +126,6 @@ page_zip_simple_validate(
ut_ad(!(page_zip->size & (page_zip->size - 1))); /* power of 2 */ ut_ad(!(page_zip->size & (page_zip->size - 1))); /* power of 2 */
ut_ad(page_zip->size <= UNIV_PAGE_SIZE); ut_ad(page_zip->size <= UNIV_PAGE_SIZE);
ut_ad(page_zip->size > PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE); ut_ad(page_zip->size > PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE);
ut_ad(page_zip->m_start >= PAGE_DATA);
ut_ad(page_zip->m_start <= page_zip->m_end); ut_ad(page_zip->m_start <= page_zip->m_end);
ut_ad(page_zip->m_end < page_zip->size); ut_ad(page_zip->m_end < page_zip->size);
return(TRUE); return(TRUE);
......
...@@ -161,11 +161,7 @@ page_zip_compress( ...@@ -161,11 +161,7 @@ page_zip_compress(
ut_a(page_is_comp((page_t*) page)); ut_a(page_is_comp((page_t*) page));
ut_ad(page_simple_validate_new((page_t*) page)); ut_ad(page_simple_validate_new((page_t*) page));
ut_ad(page_zip); ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_zip->data);
ut_ad(!(page_zip->size & (page_zip->size - 1))); /* power of 2 */
ut_ad(page_zip->size <= UNIV_PAGE_SIZE);
ut_ad(page_zip->size > PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE);
/* Check the data that will be omitted. */ /* Check the data that will be omitted. */
ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - REC_N_NEW_EXTRA_BYTES), ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - REC_N_NEW_EXTRA_BYTES),
...@@ -181,11 +177,7 @@ page_zip_compress( ...@@ -181,11 +177,7 @@ page_zip_compress(
if (UNIV_UNLIKELY(!page_get_n_recs((page_t*) page))) { if (UNIV_UNLIKELY(!page_get_n_recs((page_t*) page))) {
ut_a(rec_get_next_offs((page_t*) page + PAGE_NEW_INFIMUM, TRUE) ut_a(rec_get_next_offs((page_t*) page + PAGE_NEW_INFIMUM, TRUE)
== PAGE_NEW_SUPREMUM); == PAGE_NEW_SUPREMUM);
}/* else { }
ut_a(rec_get_next_offs((page_t*) page + PAGE_NEW_INFIMUM, TRUE)
== (page_zip_dir_get(page_zip, 0)
& PAGE_ZIP_DIR_SLOT_MASK));
}*/
n_heap = page_dir_get_n_heap((page_t*) page) - 2; n_heap = page_dir_get_n_heap((page_t*) page) - 2;
ut_a(n_heap * PAGE_ZIP_DIR_SLOT_SIZE < page_zip->size); ut_a(n_heap * PAGE_ZIP_DIR_SLOT_SIZE < page_zip->size);
...@@ -217,6 +209,7 @@ page_zip_compress( ...@@ -217,6 +209,7 @@ page_zip_compress(
&& *recs == page + (PAGE_ZIP_START + REC_N_NEW_EXTRA_BYTES)) { && *recs == page + (PAGE_ZIP_START + REC_N_NEW_EXTRA_BYTES)) {
src = page + (PAGE_ZIP_START + REC_N_NEW_EXTRA_BYTES); src = page + (PAGE_ZIP_START + REC_N_NEW_EXTRA_BYTES);
recs++; recs++;
n_heap--;
} else { } else {
src = page + PAGE_ZIP_START; src = page + PAGE_ZIP_START;
} }
...@@ -728,7 +721,8 @@ page_zip_validate( ...@@ -728,7 +721,8 @@ page_zip_validate(
#endif #endif
valid = page_zip_decompress(&temp_page_zip, temp_page, NULL) valid = page_zip_decompress(&temp_page_zip, temp_page, NULL)
&& !memcmp(page, temp_page, UNIV_PAGE_SIZE); && !memcmp(page, temp_page,
UNIV_PAGE_SIZE - FIL_PAGE_DATA_END);
buf_frame_free(temp_page); buf_frame_free(temp_page);
return(valid); return(valid);
} }
...@@ -752,8 +746,9 @@ page_zip_write( ...@@ -752,8 +746,9 @@ page_zip_write(
ut_ad(buf_block_get_page_zip(buf_block_align((byte*)str)) == page_zip); ut_ad(buf_block_get_page_zip(buf_block_align((byte*)str)) == page_zip);
ut_ad(page_zip_simple_validate(page_zip)); ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_dir_get_n_slots(ut_align_down((byte*) str, UNIV_PAGE_SIZE)) ut_ad(page_zip->m_start >= PAGE_DATA);
== page_dir_get_n_slots(page_zip->data)); ut_ad(!memcmp(ut_align_down((byte*) str, UNIV_PAGE_SIZE),
page_zip->data, PAGE_ZIP_START));
ut_ad(!page_zip->data[page_zip->m_end]); ut_ad(!page_zip->data[page_zip->m_end]);
ut_ad(pos >= PAGE_DATA); ut_ad(pos >= PAGE_DATA);
......
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