diff options
author | unknown <monty@hundin.mysql.fi> | 2002-03-27 01:56:10 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-03-27 01:56:10 +0200 |
commit | 36b38aa503c05efd0479d73dbb40e5e8f13cb986 (patch) | |
tree | 6998f99b1790b678ac1558e748e2a8c992bbfa22 /innobase/buf | |
parent | 6229932f1010c270e2319d8dc3be9670d016546e (diff) | |
parent | bbedc5ebbf8951c3b6a3d4047c40e7934774d58a (diff) | |
download | mariadb-git-36b38aa503c05efd0479d73dbb40e5e8f13cb986.tar.gz |
merge with 3.23.50
BitKeeper/etc/logging_ok:
auto-union
BUILD/SETUP.sh:
Auto merged
Build-tools/Do-compile:
Auto merged
Build-tools/Do-rpm:
Auto merged
configure.in:
Auto merged
include/mysql_com.h:
Auto merged
innobase/btr/btr0btr.c:
Auto merged
innobase/btr/btr0cur.c:
Auto merged
innobase/btr/btr0sea.c:
Auto merged
innobase/dict/dict0dict.c:
Auto merged
innobase/dict/dict0load.c:
Auto merged
innobase/fil/fil0fil.c:
Auto merged
innobase/fsp/fsp0fsp.c:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/include/sync0rw.ic:
Auto merged
innobase/log/log0log.c:
Auto merged
innobase/rem/rem0cmp.c:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0sel.c:
Auto merged
innobase/row/row0upd.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
myisam/myisampack.c:
Auto merged
mysql-test/t/range.test:
Auto merged
scripts/mysqldumpslow.sh:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/lock.cc:
Auto merged
sql/share/Makefile.am:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
support-files/mysql.spec.sh:
Auto merged
Docs/manual.texi:
merge
client/mysql.cc:
merge
client/mysqldump.c:
merge
innobase/buf/buf0buf.c:
merge
innobase/os/os0file.c:
merge
innobase/row/row0mysql.c:
merge
mysql-test/r/range.result:
merge
sql/ha_innodb.cc:
merge
sql/log_event.h:
merge
sql/mysqld.cc:
merge
sql/sql_base.cc:
merge
sql/sql_load.cc:
merge
Diffstat (limited to 'innobase/buf')
-rw-r--r-- | innobase/buf/buf0buf.c | 82 | ||||
-rw-r--r-- | innobase/buf/buf0flu.c | 47 |
2 files changed, 94 insertions, 35 deletions
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index adb61bfbb56..e840e9f143d 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -220,6 +220,10 @@ buf_calc_page_checksum( { ulint checksum; + /* Since the fields FIL_PAGE_FILE_FLUSH_LSN and ..._ARCH_LOG_NO + are written outside the buffer pool to the first pages of data + files, we have to skip them in page checksum calculation */ + checksum = ut_fold_binary(page, FIL_PAGE_FILE_FLUSH_LSN); + ut_fold_binary(page + FIL_PAGE_DATA, UNIV_PAGE_SIZE - FIL_PAGE_DATA @@ -279,8 +283,9 @@ buf_page_print( ut_sprintf_buf(buf, read_buf, UNIV_PAGE_SIZE); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Page dump in ascii and hex (%u bytes):\n%s", + " InnoDB: Page dump in ascii and hex (%u bytes):\n%s", UNIV_PAGE_SIZE, buf); fprintf(stderr, "InnoDB: End of page dump\n"); @@ -288,7 +293,8 @@ buf_page_print( checksum = buf_calc_page_checksum(read_buf); - fprintf(stderr, "InnoDB: Page checksum %lu stored checksum %lu\n", + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Page checksum %lu stored checksum %lu\n", checksum, mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN)); @@ -1358,47 +1364,87 @@ buf_page_io_complete( /*=================*/ buf_block_t* block) /* in: pointer to the block in question */ { - dulint id; dict_index_t* index; + dulint id; ulint io_type; - + ulint read_page_no; + ut_ad(block); io_type = block->io_fix; if (io_type == BUF_IO_READ) { + /* If this page is not uninitialized and not in the + doublewrite buffer, then the page number should be the + same as in block */ + + read_page_no = mach_read_from_4((block->frame) + + FIL_PAGE_OFFSET); + if (read_page_no != 0 + && !trx_doublewrite_page_inside(read_page_no) + && read_page_no != block->offset) { + + fprintf(stderr, +"InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n", + read_page_no, block->offset); + } +#ifdef notdefined + if (block->offset != 0 && read_page_no == 0) { + /* Check that the page is really uninited */ + + for (i = 0; i < UNIV_PAGE_SIZE; i++) { + + if (*((block->frame) + i) != '\0') { + fprintf(stderr, +"InnoDB: Error: page n:o in the page read in is 0, but page %lu is inited!\n", + block->offset); + break; + } + } + } +#endif /* From version 3.23.38 up we store the page checksum - to the 4 upper bytes of the page end lsn field */ + to the 4 first bytes of the page end lsn field */ if (buf_page_is_corrupted(block->frame)) { fprintf(stderr, - "InnoDB: Database page corruption or a failed\n" - "InnoDB: file read of page %lu.\n", block->offset); + "InnoDB: Database page corruption on disk or a failed\n" + "InnoDB: file read of page %lu.\n", block->offset); fprintf(stderr, - "InnoDB: You may have to recover from a backup.\n"); + "InnoDB: You may have to recover from a backup.\n"); buf_page_print(block->frame); fprintf(stderr, - "InnoDB: Database page corruption or a failed\n" - "InnoDB: file read of page %lu.\n", block->offset); + "InnoDB: Database page corruption on disk or a failed\n" + "InnoDB: file read of page %lu.\n", block->offset); fprintf(stderr, - "InnoDB: You may have to recover from a backup.\n"); + "InnoDB: You may have to recover from a backup.\n"); fprintf(stderr, - "InnoDB: It is also possible that your operating\n" - "InnoDB: system has corrupted its own file cache\n" - "InnoDB: and rebooting your computer removes the\n" - "InnoDB: error.\n"); + "InnoDB: It is also possible that your operating\n" + "InnoDB: system has corrupted its own file cache\n" + "InnoDB: and rebooting your computer removes the\n" + "InnoDB: error.\n" + "InnoDB: If the corrupt page is an index page\n" + "InnoDB: you can also try to fix the corruption\n" + "InnoDB: by dumping, dropping, and reimporting\n" + "InnoDB: the corrupt table. You can use CHECK\n" + "InnoDB: TABLE to scan your table for corruption.\n" + "InnoDB: Look also at section 6.1 of\n" + "InnoDB: http://www.innodb.com/ibman.html about\n" + "InnoDB: forcing recovery.\n"); - if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { + if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { + fprintf(stderr, + "InnoDB: Ending processing because of a corrupt database page.\n"); exit(1); } } if (recv_recovery_is_on()) { - recv_recover_page(TRUE, block->frame, block->space, - block->offset); + recv_recover_page(FALSE, TRUE, block->frame, + block->space, block->offset); } if (!recv_no_ibuf_operations) { diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c index 8184f10d6e9..4c6850af078 100644 --- a/innobase/buf/buf0flu.c +++ b/innobase/buf/buf0flu.c @@ -328,6 +328,34 @@ try_again: } /************************************************************************ +Initializes a page for writing to the tablespace. */ + +void +buf_flush_init_for_writing( +/*=======================*/ + byte* page, /* in: page */ + dulint newest_lsn, /* in: newest modification lsn to the page */ + ulint space, /* in: space id */ + ulint page_no) /* in: page number */ +{ + /* Write the newest modification lsn to the page */ + mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn); + + mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN, newest_lsn); + + /* Write to the page the space id and page number */ + + mach_write_to_4(page + FIL_PAGE_SPACE, space); + mach_write_to_4(page + FIL_PAGE_OFFSET, page_no); + + /* We overwrite the first 4 bytes of the end lsn field to store + a page checksum */ + + mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN, + buf_calc_page_checksum(page)); +} + +/************************************************************************ Does an asynchronous write of a buffer page. NOTE: in simulated aio and also when the doublewrite buffer is used, we must call buf_flush_buffered_writes after we have posted a batch of writes! */ @@ -349,23 +377,8 @@ buf_flush_write_block_low( /* Force the log to the disk before writing the modified block */ log_flush_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS); #endif - /* Write the newest modification lsn to the page */ - mach_write_to_8(block->frame + FIL_PAGE_LSN, - block->newest_modification); - mach_write_to_8(block->frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN, - block->newest_modification); - - /* Write to the page the space id and page number */ - - mach_write_to_4(block->frame + FIL_PAGE_SPACE, block->space); - mach_write_to_4(block->frame + FIL_PAGE_OFFSET, block->offset); - - /* We overwrite the first 4 bytes of the end lsn field to store - a page checksum */ - - mach_write_to_4(block->frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN, - buf_calc_page_checksum(block->frame)); - + buf_flush_init_for_writing(block->frame, block->newest_modification, + block->space, block->offset); if (!trx_doublewrite) { fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE, |