Commit 23bd5c60 authored by Satya B's avatar Satya B

Applying InnoDB snashot 5.1-ss5282, Fix for BUG#45097

BUG#45097 - Hang during recovery, redo logs for doublewrite buffer pages 

Detailed revision comments:

r5128 | vasil | 2009-05-26 17:26:37 +0300 (Tue, 26 May 2009) | 7 lines
branches/5.1:

Fix Bug#45097 Hang during recovery, redo logs for doublewrite buffer pages

Do not write redo log for the pages in the doublewrite buffer. Also, do not
make a dummy change to the page because this is not needed.

r5150 | vasil | 2009-05-27 18:56:03 +0300 (Wed, 27 May 2009) | 4 lines
branches/5.1:

Whitespace fixup.
parent 216ce3f2
...@@ -9,6 +9,8 @@ Created 12/7/1995 Heikki Tuuri ...@@ -9,6 +9,8 @@ Created 12/7/1995 Heikki Tuuri
#include "mach0data.h" #include "mach0data.h"
#include "ut0lst.h" #include "ut0lst.h"
#include "buf0buf.h" #include "buf0buf.h"
#include "fsp0types.h"
#include "trx0sys.h"
/************************************************************ /************************************************************
Opens a buffer to mlog. It must be closed with mlog_close. */ Opens a buffer to mlog. It must be closed with mlog_close. */
...@@ -174,6 +176,28 @@ mlog_write_initial_log_record_fast( ...@@ -174,6 +176,28 @@ mlog_write_initial_log_record_fast(
space = buf_block_get_space(block); space = buf_block_get_space(block);
offset = buf_block_get_page_no(block); offset = buf_block_get_page_no(block);
/* check whether the page is in the doublewrite buffer;
the doublewrite buffer is located in pages
FSP_EXTENT_SIZE, ..., 3 * FSP_EXTENT_SIZE - 1 in the
system tablespace */
if (space == TRX_SYS_SPACE
&& offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
if (trx_doublewrite_buf_is_being_created) {
/* Do nothing: we only come to this branch in an
InnoDB database creation. We do not redo log
anything for the doublewrite buffer pages. */
return(log_ptr);
} else {
fprintf(stderr,
"Error: trying to redo log a record of type "
"%d on page %lu of space %lu in the "
"doublewrite buffer, continuing anyway.\n"
"Please post a bug report to "
"bugs.mysql.com.\n",
type, offset, space);
}
}
mach_write_to_1(log_ptr, type); mach_write_to_1(log_ptr, type);
log_ptr++; log_ptr++;
log_ptr += mach_write_compressed(log_ptr, space); log_ptr += mach_write_compressed(log_ptr, space);
......
...@@ -42,6 +42,8 @@ extern trx_sys_t* trx_sys; ...@@ -42,6 +42,8 @@ extern trx_sys_t* trx_sys;
/* Doublewrite system */ /* Doublewrite system */
extern trx_doublewrite_t* trx_doublewrite; extern trx_doublewrite_t* trx_doublewrite;
/* Set to TRUE when the doublewrite buffer is being created */
extern ibool trx_doublewrite_buf_is_being_created;
extern ibool trx_doublewrite_must_reset_space_ids; extern ibool trx_doublewrite_must_reset_space_ids;
extern ibool trx_sys_multiple_tablespace_format; extern ibool trx_sys_multiple_tablespace_format;
......
...@@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri ...@@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri
/* The transaction system */ /* The transaction system */
trx_sys_t* trx_sys = NULL; trx_sys_t* trx_sys = NULL;
trx_doublewrite_t* trx_doublewrite = NULL; trx_doublewrite_t* trx_doublewrite = NULL;
ibool trx_doublewrite_buf_is_being_created = FALSE;
/* The following is set to TRUE when we are upgrading from the old format data /* The following is set to TRUE when we are upgrading from the old format data
files to the new >= 4.1.x format multiple tablespaces format data files */ files to the new >= 4.1.x format multiple tablespaces format data files */
...@@ -180,6 +181,7 @@ trx_sys_create_doublewrite_buf(void) ...@@ -180,6 +181,7 @@ trx_sys_create_doublewrite_buf(void)
start_again: start_again:
mtr_start(&mtr); mtr_start(&mtr);
trx_doublewrite_buf_is_being_created = TRUE;
page = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr); page = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -196,6 +198,7 @@ trx_sys_create_doublewrite_buf(void) ...@@ -196,6 +198,7 @@ trx_sys_create_doublewrite_buf(void)
trx_doublewrite_init(doublewrite); trx_doublewrite_init(doublewrite);
mtr_commit(&mtr); mtr_commit(&mtr);
trx_doublewrite_buf_is_being_created = FALSE;
} else { } else {
fprintf(stderr, fprintf(stderr,
"InnoDB: Doublewrite buffer not found:" "InnoDB: Doublewrite buffer not found:"
...@@ -274,14 +277,8 @@ trx_sys_create_doublewrite_buf(void) ...@@ -274,14 +277,8 @@ trx_sys_create_doublewrite_buf(void)
buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
/* Make a dummy change to the page to ensure it will
be written to disk in a flush */
mlog_write_ulint(new_page + FIL_PAGE_DATA,
TRX_SYS_DOUBLEWRITE_MAGIC_N,
MLOG_4BYTES, &mtr);
if (i == FSP_EXTENT_SIZE / 2) { if (i == FSP_EXTENT_SIZE / 2) {
ut_a(page_no == FSP_EXTENT_SIZE);
mlog_write_ulint(doublewrite mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_BLOCK1, + TRX_SYS_DOUBLEWRITE_BLOCK1,
page_no, MLOG_4BYTES, &mtr); page_no, MLOG_4BYTES, &mtr);
...@@ -291,6 +288,7 @@ trx_sys_create_doublewrite_buf(void) ...@@ -291,6 +288,7 @@ trx_sys_create_doublewrite_buf(void)
page_no, MLOG_4BYTES, &mtr); page_no, MLOG_4BYTES, &mtr);
} else if (i == FSP_EXTENT_SIZE / 2 } else if (i == FSP_EXTENT_SIZE / 2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) { + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
ut_a(page_no == 2 * FSP_EXTENT_SIZE);
mlog_write_ulint(doublewrite mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_BLOCK2, + TRX_SYS_DOUBLEWRITE_BLOCK2,
page_no, MLOG_4BYTES, &mtr); page_no, MLOG_4BYTES, &mtr);
......
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