Commit c1e3fc0e authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28977: mariabackup.huge_lsn,strict_full_crc32 fails in 10.8

recv_sys_t::recover_deferred(): Hold the exclusive page latch until
the tablespace has been set up. Otherwise, the write of the page
may be lost due to non-existent tablespace. This race only affects
the recovery of the first page in a newly created tablespace.

This race condition was introduced in MDEV-24626.
parent 2fa3ada0
...@@ -946,17 +946,13 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, ...@@ -946,17 +946,13 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
(fil_space_t::zip_size(flags), (fil_space_t::zip_size(flags),
page), size); page), size);
if (!space) if (!space)
{ goto release_and_fail;
block->page.lock.x_unlock();
goto fail;
}
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);
block->page.lock.x_unlock();
fil_node_t *node= UT_LIST_GET_FIRST(space->chain); fil_node_t *node= UT_LIST_GET_FIRST(space->chain);
node->deferred= true; node->deferred= true;
if (!space->acquire()) if (!space->acquire())
goto fail; goto release_and_fail;
fil_names_dirty(space); fil_names_dirty(space);
const bool is_compressed= fil_space_t::is_compressed(flags); const bool is_compressed= fil_space_t::is_compressed(flags);
#ifdef _WIN32 #ifdef _WIN32
...@@ -973,14 +969,16 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, ...@@ -973,14 +969,16 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
~4095ULL, is_sparse)) ~4095ULL, is_sparse))
{ {
space->release(); space->release();
goto fail; goto release_and_fail;
} }
node->deferred= false; node->deferred= false;
space->release(); space->release();
it->second.space= space; it->second.space= space;
block->page.lock.x_unlock();
return false; return false;
} }
release_and_fail:
block->page.lock.x_unlock(); block->page.lock.x_unlock();
} }
......
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