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

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
parent eb7f46ca
...@@ -1194,17 +1194,14 @@ inline size_t recv_sys_t::files_size() ...@@ -1194,17 +1194,14 @@ inline size_t recv_sys_t::files_size()
} }
/** Process a file name from a FILE_* record. /** 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] len length of the file name
@param[in] space_id the tablespace ID @param[in] space_id the tablespace ID
@param[in] deleted whether this is a FILE_DELETE record @param[in] deleted whether this is a FILE_DELETE record
@param[in] lsn lsn of the redo log @param[in] lsn lsn of the redo log
@param[in] store whether the redo log has to @param[in] store whether the redo log has to be stored */
stored */ static void fil_name_process(const char *name, ulint len, ulint space_id,
static bool deleted, lsn_t lsn, const store_t *store)
void
fil_name_process(char* name, ulint len, ulint space_id,
bool deleted, lsn_t lsn, store_t *store)
{ {
if (srv_operation == SRV_OPERATION_BACKUP if (srv_operation == SRV_OPERATION_BACKUP
|| srv_operation == SRV_OPERATION_BACKUP_NO_DEFER) { || srv_operation == SRV_OPERATION_BACKUP_NO_DEFER) {
...@@ -1226,13 +1223,17 @@ fil_name_process(char* name, ulint len, ulint space_id, ...@@ -1226,13 +1223,17 @@ fil_name_process(char* name, ulint len, ulint space_id,
file_name_t& f = p.first->second; file_name_t& f = p.first->second;
if (deleted) { if (auto d = deferred_spaces.find(static_cast<uint32_t>(space_id))) {
/* Got FILE_DELETE */ if (deleted) {
if (auto d = deferred_spaces.find(static_cast<uint32_t>(
space_id))) {
d->deleted = true; d->deleted = true;
goto got_deleted;
} }
goto reload;
}
if (deleted) {
got_deleted:
/* Got FILE_DELETE */
if (!p.second && f.status != file_name_t::DELETED) { if (!p.second && f.status != file_name_t::DELETED) {
f.status = file_name_t::DELETED; f.status = file_name_t::DELETED;
if (f.space != NULL) { if (f.space != NULL) {
...@@ -1244,6 +1245,7 @@ fil_name_process(char* name, ulint len, ulint space_id, ...@@ -1244,6 +1245,7 @@ fil_name_process(char* name, ulint len, ulint space_id,
ut_ad(f.space == NULL); ut_ad(f.space == NULL);
} else if (p.second // the first FILE_MODIFY or FILE_RENAME } else if (p.second // the first FILE_MODIFY or FILE_RENAME
|| f.name != fname.name) { || f.name != fname.name) {
reload:
fil_space_t* space; fil_space_t* space;
/* Check if the tablespace file exists and contains /* Check if the tablespace file exists and contains
......
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