Commit 3547f43d authored by marko's avatar marko

branches/zip: Fix bugs.

btr_root_raise_and_insert(): When copying root to new_page byte for byte,
restore the page number of new_page afterwards.

buf_flush_init_for_writing(): For FIL_PAGE_INDEX, write the page number
and space id also to the uncompressed page.
parent b8296570
......@@ -1088,11 +1088,19 @@ 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))) {
ut_a(new_page_zip);
byte page_no[4];
/* 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);
/* Copy the pages byte for byte. This will succeed. */
buf_frame_copy(new_page, root);
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;
......
......@@ -477,6 +477,11 @@ buf_flush_init_for_writing(
break;
case FIL_PAGE_INDEX:
ut_a(zip_size == page_zip->size);
mach_write_to_4(page
+ FIL_PAGE_OFFSET, page_no);
mach_write_to_4(page
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
space);
mach_write_to_4(page_zip->data
+ FIL_PAGE_OFFSET, page_no);
mach_write_to_8(page_zip->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