Commit 3b21e147 authored by marko's avatar marko

branches/zip: After merge fix, and cleanup.

btr_validate_level(): Add missing parameter to added buf_page_print() calls.

btr_root_raise_and_insert(): Replace low-level code with page_zip_copy().

page_zip_copy(): New function to copy the data payload of a compressed page,
byte for byte.  The file page header and trailer are not copied, to avoid
overwriting the fields FIL_PAGE_OFFSET, FIL_PAGE_PREV and FIL_PAGE_NEXT.
parent 24dce67d
......@@ -1095,24 +1095,11 @@ btr_root_raise_and_insert(
if (UNIV_UNLIKELY(!page_copy_rec_list_end(new_page, new_page_zip,
page_get_infimum_rec(root), cursor->index, mtr))) {
byte page_no[4];
ut_a(new_page_zip);
/* Copy the pages byte for byte and restore the page offset.
This cannot fail, because the compressed page
will be modified in place. */
memcpy(page_no, new_page + FIL_PAGE_OFFSET, 4);
memcpy(new_page, root, UNIV_PAGE_SIZE);
memcpy(new_page + FIL_PAGE_OFFSET, page_no, 4);
memcpy(new_page_zip->data, root_page_zip->data,
new_page_zip->size);
memcpy(new_page_zip->data + FIL_PAGE_OFFSET, page_no, 4);
new_page_zip->n_blobs = 0;
new_page_zip->m_start = root_page_zip->m_start;
new_page_zip->m_end = root_page_zip->m_end;
page_zip_compress_write_log(new_page_zip, new_page, mtr);
/* Copy the page byte for byte. */
page_zip_copy(new_page_zip, new_page,
root_page_zip, root, mtr);
}
/* If this is a pessimistic insert which is actually done to
......@@ -2964,8 +2951,8 @@ loop:
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: broken FIL_PAGE_NEXT"
" or FIL_PAGE_PREV links\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
buf_page_print(page, 0);
buf_page_print(right_page, 0);
ret = FALSE;
}
......@@ -2974,8 +2961,8 @@ loop:
!= page_is_comp(page))) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
buf_page_print(page, 0);
buf_page_print(right_page, 0);
ret = FALSE;
......
......@@ -267,6 +267,19 @@ page_zip_write_header(
mtr_t* mtr) /* in: mini-transaction, or NULL */
__attribute__((nonnull(1,2)));
/**************************************************************************
Copy a page byte for byte, except for the file page header and trailer. */
void
page_zip_copy(
/*==========*/
page_zip_des_t* page_zip, /* out: copy of src_zip */
page_t* page, /* out: copy of src */
const page_zip_des_t* src_zip, /* in: compressed page */
const page_t* src, /* in: page */
mtr_t* mtr) /* in: mini-transaction */
__attribute__((nonnull(1,2,3,4)));
/**************************************************************************
Write a log record of compressing an index page. */
......
......@@ -2928,6 +2928,37 @@ page_zip_write_header_log(
mlog_catenate_string(mtr, data, length);
}
/**************************************************************************
Copy a page byte for byte, except for the file page header and trailer. */
void
page_zip_copy(
/*==========*/
page_zip_des_t* page_zip, /* out: copy of src_zip */
page_t* page, /* out: copy of src */
const page_zip_des_t* src_zip, /* in: compressed page */
const page_t* src, /* in: page */
mtr_t* mtr) /* in: mini-transaction */
{
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(page_zip_validate(src_zip, src));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
ut_a(page_zip->size == src_zip->size);
/* Skip the file page header and trailer. */
memcpy(page + FIL_PAGE_DATA, src + FIL_PAGE_DATA,
UNIV_PAGE_SIZE - FIL_PAGE_DATA
- FIL_PAGE_DATA_END);
memcpy(page_zip->data + FIL_PAGE_DATA,
src_zip->data + FIL_PAGE_DATA,
page_zip->size - FIL_PAGE_DATA);
page_zip->n_blobs = src_zip->n_blobs;
page_zip->m_start = src_zip->m_start;
page_zip->m_end = src_zip->m_end;
page_zip_compress_write_log(page_zip, page, mtr);
}
/**************************************************************************
Write a log record of compressing an index page. */
......
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