MDEV-27014 InnoDB fails to restore page 0 from the doublewrite buffer

- Addressing the format issue in deferred_dblwr() and changed the
function comment.
parent 18c335a3
...@@ -438,10 +438,7 @@ Datafile::validate_for_recovery() ...@@ -438,10 +438,7 @@ Datafile::validate_for_recovery()
} }
if (restore_from_doublewrite()) { if (restore_from_doublewrite()) {
if (m_defer) { return m_defer ? err : DB_CORRUPTION;
return err;
}
return(DB_CORRUPTION);
} }
/* Free the previously read first page and then re-validate. */ /* Free the previously read first page and then re-validate. */
......
...@@ -797,7 +797,10 @@ static struct ...@@ -797,7 +797,10 @@ static struct
return space; return space;
} }
/* Recover the page0 of deferred tablespace from doublewrite buffer.*/ /** Attempt to recover pages from the doublewrite buffer.
This is invoked if we found neither a valid first page in the
data file nor redo log records that would initialize the first
page. */
void deferred_dblwr() void deferred_dblwr()
{ {
for (auto d= defers.begin(); d != defers.end(); ) for (auto d= defers.begin(); d != defers.end(); )
...@@ -832,10 +835,10 @@ static struct ...@@ -832,10 +835,10 @@ static struct
space->free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT); space->free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT);
space->free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page); space->free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page);
fil_node_t *node= UT_LIST_GET_FIRST(space->chain); fil_node_t *node= UT_LIST_GET_FIRST(space->chain);
if (!space->acquire()) if (!space->acquire())
goto next_item; goto next_item;
if (os_file_write(IORequestWrite, node->name, node->handle, if (os_file_write(IORequestWrite, node->name, node->handle,
page, 0, fil_space_t::physical_size(flags) != page, 0, fil_space_t::physical_size(flags) !=
DB_SUCCESS)) DB_SUCCESS))
{ {
space->release(); space->release();
......
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