diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-04-16 15:55:00 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-04-16 15:55:39 +0530 |
commit | 5b7a28b261bafe35f4706b4ba629153dcafd87eb (patch) | |
tree | bba55a53c2d1e6126a3d41856618f22360db5e79 | |
parent | 34768366014c7d9b6a6cc304381d004b451f5c9a (diff) | |
download | mariadb-git-bb-10.6-MDEV-24626.tar.gz |
MDEV-24626 Remove synchronous write of page0 and flushing file during file creationbb-10.6-MDEV-24626
- Renamed tablespace shouldn't overwrite when it encounter the past
file rename redo log.
-rw-r--r-- | storage/innobase/log/log0recv.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 342f3feac60..11d1e4d8ba2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -584,8 +584,14 @@ typedef std::map< static recv_spaces_t recv_spaces; +struct mlog_rename +{ + lsn_t lsn; + std::string file_name; +}; + /** The last parsed FILE_RENAME records */ -static std::map<uint32_t,std::string> renamed_spaces; +static std::map<uint32_t,mlog_rename> renamed_spaces; static std::set<uint32_t> defer_spaces; @@ -2225,9 +2231,10 @@ store_defer: if (fn2 && apply) { const size_t len= fn2end - fn2; - auto r= renamed_spaces.emplace(space_id, std::string{fn2, len}); - if (!r.second) - r.first->second= std::string{fn2, len}; + const mlog_rename mlog= {start_lsn, std::string{fn2, len}}; + auto r= renamed_spaces.emplace(space_id, mlog); + if (!r.second && start_lsn > r.first->second.lsn) + r.first->second= mlog; } if (is_corrupt_fs()) return true; @@ -2756,7 +2763,7 @@ static dberr_t recv_create_deferred_space(buf_block_t *first_block) const char *file_name= it->second.name.c_str(); auto renamed_space= renamed_spaces.find(first_block->page.id().space()); if (renamed_space != renamed_spaces.end()) - file_name= renamed_space->second.c_str(); + file_name= renamed_space->second.file_name.c_str(); /* char *space_name= fil_path_to_space_name(file_name); */ const uint32_t size = fsp_header_get_field(page, FSP_SIZE); @@ -3009,25 +3016,25 @@ next_page: continue; ut_ad(UT_LIST_GET_LEN(space->chain) == 1); const char *old= space->chain.start->name; - if (r.second != old) + if (r.second.file_name != old) { bool exists; os_file_type_t ftype; - const char *new_name= r.second.c_str(); + const char *new_name= r.second.file_name.c_str(); if (!os_file_status(new_name, &exists, &ftype) || exists) { ib::error() << "Cannot replay rename of tablespace " << id - << " from '" << old << "' to '" << r.second << + << " from '" << old << "' to '" << r.second.file_name << (exists ? "' because the target file exists" : "'"); found_corrupt_fs= true; } else { mysql_mutex_lock(&log_sys.mutex); - if (dberr_t err= space->rename(r.second.c_str(), false)) + if (dberr_t err= space->rename(r.second.file_name.c_str(), false)) { ib::error() << "Cannot replay rename of tablespace " << id - << " to '" << r.second << "': " << err; + << " to '" << r.second.file_name << "': " << err; found_corrupt_fs= true; } mysql_mutex_unlock(&log_sys.mutex); |