From c1e3fc0e0dcbc8275b46916fb5247e9e7635d072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 29 Jun 2022 15:48:44 +0300 Subject: [PATCH] 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. --- storage/innobase/log/log0recv.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index fa3b268cf2f..8d28eacb3ee 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -946,17 +946,13 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, (fil_space_t::zip_size(flags), page), size); if (!space) - { - block->page.lock.x_unlock(); - goto fail; - } + goto release_and_fail; space->free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT); 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); node->deferred= true; if (!space->acquire()) - goto fail; + goto release_and_fail; fil_names_dirty(space); const bool is_compressed= fil_space_t::is_compressed(flags); #ifdef _WIN32 @@ -973,14 +969,16 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p, ~4095ULL, is_sparse)) { space->release(); - goto fail; + goto release_and_fail; } node->deferred= false; space->release(); it->second.space= space; + block->page.lock.x_unlock(); return false; } + release_and_fail: block->page.lock.x_unlock(); }