diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-23 13:17:20 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-23 13:17:20 +0300 |
commit | f2f18e20ebfff2b744a08ba169bcedd1477b228c (patch) | |
tree | 0fce3606cfd0ec1241856204c1a3984687136678 | |
parent | eb7f46ca1e7a8dc90b587b38c0f2b64a975c73a3 (diff) | |
download | mariadb-git-f2f18e20ebfff2b744a08ba169bcedd1477b228c.tar.gz |
MDEV-28923 atomic.rename_table occasionally fails
fil_name_process(): If the recovery of a tablespace was deferred,
do invoke fil_ibd_load() even though the name in recv_spaces is
not changing. This allows us to recover from a situation where
there are many FILE_RENAME records, renaming a tablespace back
and forth, and a FILE_MODIFY record that had been written by
fil_names_clear().
Co-developed with: Thirunarayanan Balathandayuthapani
-rw-r--r-- | storage/innobase/log/log0recv.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 377c08b9290..fa3b268cf2f 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1194,17 +1194,14 @@ inline size_t recv_sys_t::files_size() } /** Process a file name from a FILE_* record. -@param[in,out] name file name +@param[in] name file name @param[in] len length of the file name @param[in] space_id the tablespace ID @param[in] deleted whether this is a FILE_DELETE record @param[in] lsn lsn of the redo log -@param[in] store whether the redo log has to - stored */ -static -void -fil_name_process(char* name, ulint len, ulint space_id, - bool deleted, lsn_t lsn, store_t *store) +@param[in] store whether the redo log has to be stored */ +static void fil_name_process(const char *name, ulint len, ulint space_id, + bool deleted, lsn_t lsn, const store_t *store) { if (srv_operation == SRV_OPERATION_BACKUP || srv_operation == SRV_OPERATION_BACKUP_NO_DEFER) { @@ -1226,13 +1223,17 @@ fil_name_process(char* name, ulint len, ulint space_id, file_name_t& f = p.first->second; - if (deleted) { - /* Got FILE_DELETE */ - if (auto d = deferred_spaces.find(static_cast<uint32_t>( - space_id))) { + if (auto d = deferred_spaces.find(static_cast<uint32_t>(space_id))) { + if (deleted) { d->deleted = true; + goto got_deleted; } + goto reload; + } + if (deleted) { +got_deleted: + /* Got FILE_DELETE */ if (!p.second && f.status != file_name_t::DELETED) { f.status = file_name_t::DELETED; if (f.space != NULL) { @@ -1244,6 +1245,7 @@ fil_name_process(char* name, ulint len, ulint space_id, ut_ad(f.space == NULL); } else if (p.second // the first FILE_MODIFY or FILE_RENAME || f.name != fname.name) { +reload: fil_space_t* space; /* Check if the tablespace file exists and contains |