diff --git a/btr/btr0btr.c b/btr/btr0btr.c index 433239830e0..08c157a5d04 100644 --- a/btr/btr0btr.c +++ b/btr/btr0btr.c @@ -605,9 +605,9 @@ btr_page_get_father_for_rec( buf_frame_get_page_no(page))) { rec_t* print_rec; fputs("InnoDB: Dump of the child page:\n", stderr); - buf_page_print(buf_frame_align(page)); + buf_page_print(buf_frame_align(page), 0); fputs("InnoDB: Dump of the parent page:\n", stderr); - buf_page_print(buf_frame_align(node_ptr)); + buf_page_print(buf_frame_align(node_ptr), 0); fputs("InnoDB: Corruption of an index tree: table ", stderr); ut_print_name(stderr, NULL, index->table_name); @@ -925,8 +925,8 @@ btr_page_reorganize_low( if (UNIV_UNLIKELY(data_size1 != data_size2) || UNIV_UNLIKELY(max_ins_size1 != max_ins_size2)) { - buf_page_print(page); - buf_page_print(temp_page); + buf_page_print(page, 0); + buf_page_print(temp_page, 0); fprintf(stderr, "InnoDB: Error: page old data size %lu new data size %lu\n" "InnoDB: Error: page old max ins size %lu new max ins size %lu\n" @@ -2676,7 +2676,7 @@ btr_index_rec_validate( (ulong) rec_get_n_fields_old(rec), (ulong) n); if (dump_on_error) { - buf_page_print(page); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_old(stderr, rec); @@ -2710,7 +2710,7 @@ btr_index_rec_validate( (ulong) i, (ulong) len, (ulong) dtype_get_fixed_size(type)); if (dump_on_error) { - buf_page_print(page); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_new(stderr, rec, offsets); @@ -2924,8 +2924,8 @@ loop: fputs("InnoDB: records in wrong order" " on adjacent pages\n", stderr); - buf_page_print(page); - buf_page_print(right_page); + buf_page_print(page, 0); + buf_page_print(right_page, 0); fputs("InnoDB: record ", stderr); rec = page_rec_get_prev(page_get_supremum_rec(page)); @@ -2967,8 +2967,8 @@ loop: fputs("InnoDB: node pointer to the page is wrong\n", stderr); - buf_page_print(father_page); - buf_page_print(page); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: node ptr ", stderr); rec_print_new(stderr, node_ptr, offsets); @@ -3007,8 +3007,8 @@ loop: btr_validate_report1(index, level, page); - buf_page_print(father_page); - buf_page_print(page); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: Error: node ptrs differ" " on levels > 0\n" @@ -3052,9 +3052,9 @@ loop: btr_validate_report1(index, level, page); - buf_page_print(father_page); - buf_page_print(page); - buf_page_print(right_page); + buf_page_print(father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } else { right_father_page = buf_frame_align( @@ -3071,10 +3071,10 @@ loop: btr_validate_report1(index, level, page); - buf_page_print(father_page); - buf_page_print(right_father_page); - buf_page_print(page); - buf_page_print(right_page); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } if (buf_frame_get_page_no(right_father_page) @@ -3088,10 +3088,10 @@ loop: btr_validate_report1(index, level, page); - buf_page_print(father_page); - buf_page_print(right_father_page); - buf_page_print(page); - buf_page_print(right_page); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } } diff --git a/btr/btr0sea.c b/btr/btr0sea.c index f5a9497dcca..7072b1c71e9 100644 --- a/btr/btr0sea.c +++ b/btr/btr0sea.c @@ -1672,7 +1672,7 @@ btr_search_validate(void) (ulong) block->curr_n_bytes, (ulong) block->curr_side); if (n_page_dumps < 20) { - buf_page_print(page); + buf_page_print(page, 0); n_page_dumps++; } } diff --git a/buf/buf0buf.c b/buf/buf0buf.c index 46085d9673b..59fb0b4d0f8 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -410,19 +410,88 @@ Prints a page to stderr. */ void buf_page_print( /*===========*/ - byte* read_buf) /* in: a database page */ + byte* read_buf, /* in: a database page */ + ulint zip_size) /* in: compressed page size, or + 0 for uncompressed pages */ { dict_index_t* index; ulint checksum; ulint old_checksum; + ulint size = zip_size; + + if (!size) { + size = UNIV_PAGE_SIZE; + } ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n", - (ulint)UNIV_PAGE_SIZE); - ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE); + (ulong) size); + ut_print_buf(stderr, read_buf, size); fputs("InnoDB: End of page dump\n", stderr); - /* TODO: print zipped pages differently, esp. BLOB pages */ + if (zip_size) { + /* Print compressed page. */ + + switch (fil_page_get_type(read_buf)) { + case FIL_PAGE_TYPE_ZBLOB: + checksum = srv_use_checksums + ? buf_calc_zblob_page_checksum( + read_buf, zip_size) + : BUF_NO_CHECKSUM_MAGIC; + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Compressed BLOB page checksum %lu, stored %lu\n" +"InnoDB: Page lsn %lu %lu\n" +"InnoDB: Page number (if stored to page already) %lu,\n" +"InnoDB: space id (if stored to page already) %lu\n", + (ulong) checksum, + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_SPACE_OR_CHKSUM), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_LSN), + (ulong) mach_read_from_4(read_buf + + (FIL_PAGE_LSN + 4)), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_OFFSET), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_ZBLOB_SPACE_ID)); + return; + default: + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: unknown page type %lu, assuming FIL_PAGE_INDEX\n", + fil_page_get_type(read_buf)); + /* fall through */ + case FIL_PAGE_INDEX: + checksum = srv_use_checksums + ? page_zip_calc_checksum( + read_buf, zip_size) + : BUF_NO_CHECKSUM_MAGIC; + + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Compressed page checksum %lu, stored %lu\n" +"InnoDB: Page lsn %lu %lu\n" +"InnoDB: Page number (if stored to page already) %lu,\n" +"InnoDB: space id (if stored to page already) %lu\n", + (ulong) checksum, + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_SPACE_OR_CHKSUM), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_LSN), + (ulong) mach_read_from_4(read_buf + + (FIL_PAGE_LSN + 4)), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_OFFSET), + (ulong) mach_read_from_4(read_buf + + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); + return; + case FIL_PAGE_TYPE_XDES: + /* This is an uncompressed page. */ + break; + } + } + checksum = srv_use_checksums ? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC; old_checksum = srv_use_checksums ? @@ -465,18 +534,21 @@ buf_page_print( (ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)), (ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf))); +#ifdef UNIV_HOTBACKUP /* If the code is in ibbackup, dict_sys may be uninitialized, i.e., NULL */ - if (dict_sys != NULL) { + if (dict_sys == NULL) { + break; + } +#endif /* UNIV_HOTBACKUP */ - index = dict_index_find_on_id_low( - btr_page_get_index_id(read_buf)); - if (index) { - fputs("InnoDB: (", stderr); - dict_index_name_print(stderr, NULL, index); - fputs(")\n", stderr); - } + index = dict_index_find_on_id_low( + btr_page_get_index_id(read_buf)); + if (index) { + fputs("InnoDB: (", stderr); + dict_index_name_print(stderr, NULL, index); + fputs(")\n", stderr); } break; case FIL_PAGE_INODE: @@ -1941,7 +2013,7 @@ buf_page_io_complete( fputs( "InnoDB: You may have to recover from a backup.\n", stderr); - buf_page_print(block->frame); + buf_page_print(block->frame, block->page_zip.size); fprintf(stderr, "InnoDB: Database page corruption on disk or a failed\n" diff --git a/buf/buf0flu.c b/buf/buf0flu.c index 8c4237a4e53..e8f1a105b28 100644 --- a/buf/buf0flu.c +++ b/buf/buf0flu.c @@ -16,6 +16,7 @@ Created 11/11/1995 Heikki Tuuri #include "ut0byte.h" #include "ut0lst.h" #include "page0page.h" +#include "page0zip.h" #include "fil0fil.h" #include "buf0buf.h" #include "buf0lru.h" @@ -254,6 +255,8 @@ buf_flush_buffered_writes(void) block = trx_doublewrite->buf_block_arr[i]; ut_a(block->state == BUF_BLOCK_FILE_PAGE); + /* TODO: page_zip */ + if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4) != mach_read_from_4(block->frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) { @@ -269,7 +272,7 @@ buf_flush_buffered_writes(void) if (UNIV_UNLIKELY(!page_simple_validate_new( block->frame))) { corrupted_page: - buf_page_print(block->frame); + buf_page_print(block->frame, 0); ut_print_timestamp(stderr); fprintf(stderr, @@ -456,12 +459,12 @@ buf_flush_init_for_writing( page_zip_des_t* page_zip = page_zip_; ulint zip_size = fil_space_get_zip_size(space); - if (zip_size) { - switch (fil_page_get_type(page)) { + if (zip_size && zip_size != ULINT_UNDEFINED) { + switch (UNIV_EXPECT(fil_page_get_type(page), FIL_PAGE_INDEX)) { case FIL_PAGE_TYPE_ZBLOB: ut_ad(!page_zip); mach_write_to_4(page + FIL_PAGE_OFFSET, page_no); - mach_write_to_4(page + FIL_PAGE_PREV, space); + mach_write_to_4(page + FIL_PAGE_ZBLOB_SPACE_ID, space); mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn); mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, srv_use_checksums @@ -469,9 +472,28 @@ buf_flush_init_for_writing( page, zip_size) : BUF_NO_CHECKSUM_MAGIC); return; - case FIL_PAGE_INDEX: - /* TODO: special handling */ + case FIL_PAGE_TYPE_XDES: + /* This is essentially an uncompressed page. */ break; + case FIL_PAGE_INDEX: + ut_a(zip_size == page_zip->size); + mach_write_to_4(page_zip->data + + FIL_PAGE_OFFSET, page_no); + mach_write_to_8(page_zip->data + + FIL_PAGE_LSN, newest_lsn); + mach_write_to_4(page_zip->data + + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, + space); + memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8); + mach_write_to_4(page_zip->data + + FIL_PAGE_SPACE_OR_CHKSUM, + srv_use_checksums + ? page_zip_calc_checksum( + page_zip->data, zip_size) + : BUF_NO_CHECKSUM_MAGIC); + return; + default: + ut_error; } } @@ -491,16 +513,6 @@ buf_flush_init_for_writing( srv_use_checksums ? buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC); - if (UNIV_LIKELY_NULL(page_zip)) { - /* Copy FIL_PAGE_SPACE_OR_CHKSUM and FIL_PAGE_OFFSET */ - memcpy(page_zip->data, page, FIL_PAGE_PREV); - /* Copy FIL_PAGE_LSN */ - memcpy(page_zip->data + FIL_PAGE_LSN, page + FIL_PAGE_LSN, 8); - /* Copy FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID */ - memcpy(page_zip->data + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, - page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 4); - } - /* We overwrite the first 4 bytes of the end lsn field to store the old formula checksum. Since it depends also on the field FIL_PAGE_SPACE_OR_CHKSUM, it has to be calculated after storing the diff --git a/ibuf/ibuf0ibuf.c b/ibuf/ibuf0ibuf.c index 27b4f90bb29..1fae913fcfb 100644 --- a/ibuf/ibuf0ibuf.c +++ b/ibuf/ibuf0ibuf.c @@ -2839,7 +2839,7 @@ ibuf_insert_to_index_page( "InnoDB: Trying to insert a record from the insert buffer to an index page\n" "InnoDB: but the number of fields does not match!\n", stderr); dump: - buf_page_print(page); + buf_page_print(page, 0); dtuple_print(stderr, entry); @@ -3147,13 +3147,13 @@ ibuf_merge_or_delete_for_page( bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr); - buf_page_print(bitmap_page); + buf_page_print(bitmap_page, 0); mtr_commit(&mtr); fputs("\nInnoDB: Dump of the page:\n", stderr); - buf_page_print(page); + buf_page_print(page, 0); fprintf(stderr, "InnoDB: Error: corruption in the tablespace. Bitmap shows insert\n" diff --git a/include/btr0btr.ic b/include/btr0btr.ic index e6035c13039..18f46e6750f 100644 --- a/include/btr0btr.ic +++ b/include/btr0btr.ic @@ -235,7 +235,7 @@ btr_node_ptr_get_child_page_no( fprintf(stderr, "InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n", (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE)); - buf_page_print(buf_frame_align(rec)); + buf_page_print(buf_frame_align(rec), 0); } return(page_no); diff --git a/include/buf0buf.h b/include/buf0buf.h index 43126724449..f1f0b9b0838 100644 --- a/include/buf0buf.h +++ b/include/buf0buf.h @@ -517,7 +517,9 @@ Prints a page to stderr. */ void buf_page_print( /*===========*/ - byte* read_buf); /* in: a database page */ + byte* read_buf, /* in: a database page */ + ulint zip_size); /* in: compressed page size, or + 0 for uncompressed pages */ /************************************************************************* Returns the number of latched pages in the buffer pool. */ diff --git a/include/fil0fil.h b/include/fil0fil.h index f502bab2a07..1cd6d4d8a75 100644 --- a/include/fil0fil.h +++ b/include/fil0fil.h @@ -58,6 +58,8 @@ extern fil_addr_t fil_addr_null; #define FIL_PAGE_OFFSET 4 /* page offset inside space */ #define FIL_PAGE_PREV 8 /* if there is a 'natural' predecessor of the page, its offset */ +#define FIL_PAGE_ZBLOB_SPACE_ID 8 /* space id of a compressed BLOB page, + 4 bytes */ #define FIL_PAGE_NEXT 12 /* if there is a 'natural' successor of the page, its offset */ #define FIL_PAGE_LSN 16 /* lsn of the end of the newest diff --git a/include/page0page.ic b/include/page0page.ic index 71df34b881e..6686438909b 100644 --- a/include/page0page.ic +++ b/include/page0page.ic @@ -612,7 +612,7 @@ page_rec_get_next( rec, buf_pool->frame_zero, buf_pool->high_end, (ulong)buf_block_align(rec)->buf_fix_count); - buf_page_print(page); + buf_page_print(page, 0); ut_error; } diff --git a/include/page0zip.h b/include/page0zip.h index 28d3206f888..c5823e06da7 100644 --- a/include/page0zip.h +++ b/include/page0zip.h @@ -291,6 +291,17 @@ page_zip_parse_compress( page_zip_des_t* page_zip)/* out: compressed page */ __attribute__((nonnull(1,2))); +/************************************************************************** +Calculate the compressed page checksum. */ + +ulint +page_zip_calc_checksum( +/*===================*/ + /* out: page checksum */ + const void* data, /* in: compressed page */ + ulint size) /* in: size of compressed page */ + __attribute__((nonnull)); + #ifdef UNIV_MATERIALIZE # undef UNIV_INLINE # define UNIV_INLINE UNIV_INLINE_ORIGINAL diff --git a/lock/lock0lock.c b/lock/lock0lock.c index e54ba519deb..c547dcd0701 100644 --- a/lock/lock0lock.c +++ b/lock/lock0lock.c @@ -1691,7 +1691,7 @@ lock_sec_rec_some_has_impl_off_kernel( if (!lock_check_trx_id_sanity(page_get_max_trx_id(page), rec, index, offsets, TRUE)) { - buf_page_print(page); + buf_page_print(page, 0); /* The page is corrupt: try to avoid a crash by returning NULL */ diff --git a/os/os0file.c b/os/os0file.c index d10bdccbd2b..bbfef77ef29 100644 --- a/os/os0file.c +++ b/os/os0file.c @@ -3928,6 +3928,8 @@ consecutive_loop: is sensible; reported page checksum errors from Linux seem to wipe over the page end */ + /* TODO: disable this for compressed pages */ + for (len2 = 0; len2 + UNIV_PAGE_SIZE <= total_len; len2 += UNIV_PAGE_SIZE) { if (mach_read_from_4(combined_buf + len2 @@ -3941,7 +3943,7 @@ consecutive_loop: fprintf(stderr, "InnoDB: Writing a block of %lu bytes, currently writing at offset %lu\n", (ulong)total_len, (ulong)len2); - buf_page_print(combined_buf + len2); + buf_page_print(combined_buf + len2, 0); fprintf(stderr, "InnoDB: ERROR: The page to be written seems corrupt!\n"); } diff --git a/page/page0cur.c b/page/page0cur.c index 6e277a4e7dc..9b6f7513a53 100644 --- a/page/page0cur.c +++ b/page/page0cur.c @@ -838,7 +838,7 @@ page_cur_parse_insert_rec( fputs("Dump of 300 bytes of log:\n", stderr); ut_print_buf(stderr, ptr2, 300); - buf_page_print(page); + buf_page_print(page, 0); ut_error; } diff --git a/page/page0page.c b/page/page0page.c index 778ea566f8c..f9517b06b2b 100644 --- a/page/page0page.c +++ b/page/page0page.c @@ -140,7 +140,7 @@ page_dir_find_owner_slot( fputs("\n" "InnoDB: on that page!\n", stderr); - buf_page_print(page); + buf_page_print(page, 0); ut_error; } @@ -559,8 +559,8 @@ page_copy_rec_list_end_no_locks( /* Track an assertion failure reported on the mailing list on June 18th, 2003 */ - buf_page_print(new_page); - buf_page_print(ut_align_down(rec, UNIV_PAGE_SIZE)); + buf_page_print(new_page, 0); + buf_page_print(ut_align_down(rec, UNIV_PAGE_SIZE), 0); ut_print_timestamp(stderr); fprintf(stderr, @@ -1720,20 +1720,21 @@ page_check_dir( n_slots = page_dir_get_n_slots(page); - if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, 0)) - != page_get_infimum_rec(page)) { + if (UNIV_UNLIKELY(page_dir_slot_get_rec(page_dir_get_nth_slot(page, 0)) + != page_get_infimum_rec(page))) { fprintf(stderr, -"InnoDB: Page directory corruption: supremum not pointed to\n"); - buf_page_print(page); +"InnoDB: Page directory corruption: infimum not pointed to\n"); + buf_page_print(page, 0); } - if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, n_slots - 1)) - != page_get_supremum_rec(page)) { + if (UNIV_UNLIKELY(page_dir_slot_get_rec(page_dir_get_nth_slot( + page, n_slots - 1)) + != page_get_supremum_rec(page))) { fprintf(stderr, "InnoDB: Page directory corruption: supremum not pointed to\n"); - buf_page_print(page); + buf_page_print(page, 0); } } @@ -2389,7 +2390,7 @@ func_exit: (ulong) buf_frame_get_page_no(page)); dict_index_name_print(stderr, NULL, index); putc('\n', stderr); - buf_page_print(page); + buf_page_print(page, 0); } return(ret); diff --git a/page/page0zip.c b/page/page0zip.c index 6b5acd7101b..d5280362d7c 100644 --- a/page/page0zip.c +++ b/page/page0zip.c @@ -538,6 +538,7 @@ page_zip_compress( byte* storage;/* storage of uncompressed columns */ ut_a(page_is_comp((page_t*) page)); + ut_a(fil_page_get_type((page_t*) page) == FIL_PAGE_INDEX); ut_ad(page_simple_validate_new((page_t*) page)); ut_ad(page_zip_simple_validate(page_zip)); @@ -870,8 +871,13 @@ zlib_error: page_zip->m_end = page_zip->m_start = PAGE_DATA + c_stream.total_out; page_zip->n_blobs = n_blobs; - /* Copy the page header */ - memcpy(page_zip->data, page, PAGE_DATA); + /* Copy those header fields that will not be written + in buf_flush_init_for_writing() */ + memcpy(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, + FIL_PAGE_LSN - FIL_PAGE_PREV); + memcpy(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2); + memcpy(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, + PAGE_DATA - FIL_PAGE_DATA); /* Copy the rest of the compressed page */ memcpy(page_zip->data + PAGE_DATA, buf, page_zip->size - PAGE_DATA); mem_heap_free(heap); @@ -1902,6 +1908,26 @@ func_exit: } #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ +#ifdef UNIV_DEBUG +static +ibool +page_zip_header_cmp( +/*================*/ + /* out: TRUE */ + const page_zip_des_t* page_zip,/* in: compressed page */ + const byte* page) /* in: uncompressed page */ +{ + ut_ad(!memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, + FIL_PAGE_LSN - FIL_PAGE_PREV)); + ut_ad(!memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, + 2)); + ut_ad(!memcmp(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, + PAGE_DATA - FIL_PAGE_DATA)); + + return(TRUE); +} +#endif /* UNIV_DEBUG */ + /************************************************************************** Write an entire record on the compressed page. The data must already have been written to the uncompressed page. */ @@ -1928,10 +1954,11 @@ page_zip_write_rec( ut_ad(rec_offs_validate((rec_t*) rec, index, offsets)); ut_ad(page_zip->m_start >= PAGE_DATA); - ut_ad(!memcmp(ut_align_down((byte*) rec, UNIV_PAGE_SIZE), - page_zip->data, PAGE_DATA)); page = ut_align_down((rec_t*) rec, UNIV_PAGE_SIZE); + + ut_ad(page_zip_header_cmp(page_zip, page)); + slot = page_zip_dir_find(page_zip, ut_align_offset(rec, UNIV_PAGE_SIZE)); ut_a(slot); @@ -2228,7 +2255,7 @@ page_zip_write_blob_ptr( ut_ad(rec_offs_nth_extern(offsets, n)); ut_ad(page_zip->m_start >= PAGE_DATA); - ut_ad(!memcmp(page, page_zip->data, PAGE_DATA)); + ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(page_is_leaf(page)); @@ -2379,7 +2406,7 @@ page_zip_write_node_ptr( ut_ad(page_rec_is_comp(rec)); ut_ad(page_zip->m_start >= PAGE_DATA); - ut_ad(!memcmp(page, page_zip->data, PAGE_DATA)); + ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(!page_is_leaf(page)); @@ -2443,7 +2470,7 @@ page_zip_write_trx_id_and_roll_ptr( ut_ad(rec_offs_comp(offsets)); ut_ad(page_zip->m_start >= PAGE_DATA); - ut_ad(!memcmp(page, page_zip->data, PAGE_DATA)); + ut_ad(page_zip_header_cmp(page_zip, page)); ut_ad(page_is_leaf(page)); @@ -2936,3 +2963,19 @@ corrupt: return(ptr + size); } + +/************************************************************************** +Calculate the compressed page checksum. */ + +ulint +page_zip_calc_checksum( +/*===================*/ + /* out: page checksum */ + const void* data, /* in: compressed page */ + ulint size) /* in: size of compressed page */ +{ + /* Exclude the 32-bit checksum field from the checksum. */ + return((ulint) adler32(0, + ((const Bytef*) data) + FIL_PAGE_OFFSET, + size - FIL_PAGE_OFFSET)); +} diff --git a/row/row0sel.c b/row/row0sel.c index af004e898f8..de3a9011130 100644 --- a/row/row0sel.c +++ b/row/row0sel.c @@ -3720,7 +3720,7 @@ rec_loop: wrong_offs: if (srv_force_recovery == 0 || moves_up == FALSE) { ut_print_timestamp(stderr); - buf_page_print(buf_frame_align(rec)); + buf_page_print(buf_frame_align(rec), 0); fprintf(stderr, "\nInnoDB: rec address %p, first buffer frame %p\n" "InnoDB: buffer pool high end %p, buf block fix count %lu\n", diff --git a/trx/trx0sys.c b/trx/trx0sys.c index d4f78c8666d..ab63397cd36 100644 --- a/trx/trx0sys.c +++ b/trx/trx0sys.c @@ -489,10 +489,10 @@ trx_sys_doublewrite_init_or_restore_pages( if (buf_page_is_corrupted(page, zip_size)) { fprintf(stderr, "InnoDB: Dump of the page:\n"); - buf_page_print(read_buf); + buf_page_print(read_buf, zip_size); fprintf(stderr, "InnoDB: Dump of corresponding page in doublewrite buffer:\n"); - buf_page_print(page); + buf_page_print(page, zip_size); fprintf(stderr, "InnoDB: Also the page in the doublewrite buffer is corrupt.\n"