Commit d35c4375 authored by marko's avatar marko

buf_page_io_complete(): Write to the error log if the page number or the

space id on the disk do not match those in the memory.  Also write to
the error log if a page was read from the doublewrite buffer.  The
doublewrite buffer should be only read by the lower-level function fil_io()
at database startup.
parent 0677a1ec
...@@ -1854,7 +1854,6 @@ buf_page_io_complete( ...@@ -1854,7 +1854,6 @@ buf_page_io_complete(
buf_block_t* block) /* in: pointer to the block in question */ buf_block_t* block) /* in: pointer to the block in question */
{ {
ulint io_type; ulint io_type;
ulint read_page_no;
ut_ad(block); ut_ad(block);
...@@ -1864,18 +1863,36 @@ buf_page_io_complete( ...@@ -1864,18 +1863,36 @@ buf_page_io_complete(
if (io_type == BUF_IO_READ) { if (io_type == BUF_IO_READ) {
/* If this page is not uninitialized and not in the /* If this page is not uninitialized and not in the
doublewrite buffer, then the page number should be the doublewrite buffer, then the page number and space id
same as in block */ should be the same as in block. */
ulint read_page_no = mach_read_from_4((block->frame)
read_page_no = mach_read_from_4((block->frame)
+ FIL_PAGE_OFFSET); + FIL_PAGE_OFFSET);
if (read_page_no != 0 ulint read_space_id = mach_read_from_4((block->frame)
&& !trx_doublewrite_page_inside(read_page_no) + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
&& read_page_no != block->offset) {
if (!block->space && trx_doublewrite_page_inside(
block->offset)) {
ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n", " InnoDB: Error: reading page %lu\n"
(ulong) read_page_no, (ulong) block->offset); "InnoDB: which is in the doublewrite buffer!\n",
(ulong) block->offset);
} else if (!read_space_id && !read_page_no) {
/* This is likely an uninitialized page. */
} else if ((block->space && block->space != read_space_id)
|| block->offset != read_page_no) {
/* We did not compare space_id to read_space_id
if block->space == 0, because the field on the
page may contain garbage in MySQL < 4.1.1,
which only supported block->space == 0. */
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: space id and page n:o stored in the page\n"
"InnoDB: read in are %lu:%lu, should be %lu:%lu!\n",
(ulong) read_space_id, (ulong) read_page_no,
(ulong) block->space, (ulong) block->offset);
} }
/* From version 3.23.38 up we store the page checksum /* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */ to the 4 first bytes of the page end lsn field */
......
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