Commit 8423294a authored by Marko Mäkelä's avatar Marko Mäkelä

Make InnoDB doublewrite buffer creation more robust.

buf_dblwr_create(): Remove a bogus check for the buffer pool size.
Theoretically, there is no problem if the doublewrite buffer is
larger than the buffer pool. It could only cause trouble on crash
recovery, and on recovery the doublewrite buffer is read to a buffer
that is allocated outside of the buffer pool. Moreover, this check
was only performed when the database was initialized for the first
time.

On a normal startup, buf_dblwr_init() would not enforce any
rule on the innodb_buffer_pool_size.

Furthermore, in case of an error, commit the mini-transaction in order
to avoid an assertion failure on shutdown. Yes, this will leave the
doublewrite buffer in a corrupted stage, but the doublewrite buffer
should only be initialized when the data files are being initialized
from the scratch in the first place.
parent 35e582c9
......@@ -206,19 +206,6 @@ buf_dblwr_create(void)
ib::info() << "Doublewrite buffer not found: creating new";
ulint min_doublewrite_size =
( ( 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2
+ 100)
* UNIV_PAGE_SIZE);
if (buf_pool_get_curr_size() < min_doublewrite_size) {
ib::error() << "Cannot create doublewrite buffer: you must"
" increase your buffer pool size. Cannot continue"
" operation.";
return(false);
}
block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
TRX_SYS_DOUBLEWRITE
+ TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
......@@ -233,9 +220,9 @@ buf_dblwr_create(void)
" increase your tablespace size."
" Cannot continue operation.";
/* We exit without committing the mtr to prevent
its modifications to the database getting to disk */
/* The mini-transaction did not write anything yet;
we merely failed to allocate a page. */
mtr.commit();
return(false);
}
......@@ -250,7 +237,12 @@ buf_dblwr_create(void)
ib::error() << "Cannot create doublewrite buffer: "
" you must increase your tablespace size."
" Cannot continue operation.";
/* This may essentially corrupt the doublewrite
buffer. However, usually the doublewrite buffer
is created at database initialization, and it
should not matter (just remove all newly created
InnoDB files and restart). */
mtr.commit();
return(false);
}
......
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