Skip to content

Commit

Permalink
fix incr path
Browse files Browse the repository at this point in the history
  • Loading branch information
aybek committed Feb 13, 2024
1 parent 7f6652f commit 58a63a6
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions storage/innobase/xtrabackup/src/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5501,16 +5501,16 @@ static bool prepare_handle_ren_files(
char dest_space_name[FN_REFLEN];
space_id_t source_space_id;
std::string ren_file_content;
std::string ren_file = entry.file_name;
std::string ren_file_name = entry.file_name;
std::string ren_path = entry.path;

Fil_path::normalize(ren_path);
//trim .ibd.ren
source_space_id = atoi(ren_file.substr(0, ren_file.length() - 8).c_str());
source_space_id = atoi(ren_file_name.substr(0, ren_file_name.length() - 8).c_str());
ren_file_content = read_file_as_string(ren_path);

if (ren_file_content.empty()) {
xb::error() << ren_path << " is empty.";
xb::error() << "prepare_handle_ren_files: " << ren_path << " is empty.";
return false;
}
//trim .ibd
Expand All @@ -5531,19 +5531,19 @@ static bool prepare_handle_ren_files(
xb::info() << "prepare_handle_ren_files: renaming " << fil_space->name << " to " << dest_space_name;

if (!fil_rename_tablespace(fil_space->id, oldpath, tmpname, NULL)) {
xb::error() << "Cannot rename " << fil_space->name << " to "
xb::error() << "prepare_handle_ren_files: Cannot rename " << fil_space->name << " to "
<< dest_space_name;
ut::free(oldpath);
ut::free(space_name);
return false;
}
// rename .delta .meta files as well
if (xtrabackup_incremental) {
std::string from_path(oldpath);
std::string to_path = entry.datadir + OS_PATH_SEPARATOR + ren_file_content;
std::string from_path = entry.datadir + OS_PATH_SEPARATOR + std::string{space_name};;
std::string to_path = entry.datadir + ren_file_content;

rename_force(from_path + ".delta", to_path + ".delta");
rename_force(from_path + ".meta", to_path + ".meta");
rename_force(from_path + ".ibd.delta", to_path + ".delta");
rename_force(from_path + ".ibd.meta", to_path + ".meta");
}
// delete the .ren file, we don't need it anymore
os_file_delete(0, ren_path.c_str());
Expand All @@ -5567,12 +5567,12 @@ static bool prepare_handle_del_files(
void *arg __attribute__((unused))) {
if (entry.is_empty_dir) return true;

std::string del_file = entry.file_name;
std::string del_path = entry.path;
std::string del_file_name = entry.file_name;
std::string del_file = entry.path;
space_id_t space_id;

//trim .ibd.del
space_id = atoi(del_file.substr(0, del_file.length() - 8).c_str());
space_id = atoi(del_file_name.substr(0, del_file_name.length() - 8).c_str());
fil_space_t *fil_space = fil_space_get(space_id);
if (fil_space != NULL) {
char *path, *space_name;
Expand All @@ -5585,22 +5585,22 @@ static bool prepare_handle_del_files(

dberr_t err = fil_delete_tablespace(fil_space->id, BUF_REMOVE_NONE);
if (err != DB_SUCCESS) {
xb::error() << "Cannot delete " << fil_space->name;
xb::error() << "prepare_handle_del_files: Cannot delete " << fil_space->name;
ut::free(path);
ut::free(space_name);
return false;
}

os_file_delete(0, del_path.c_str());
os_file_delete(0, del_file.c_str());
if (xtrabackup_incremental) {
std::string inc_path(path);
delete_force(inc_path + ".delta");
delete_force(inc_path + ".meta");
std::string del_path = entry.datadir + OS_PATH_SEPARATOR + std::string{space_name};
delete_force(del_path + ".ibd.delta");
delete_force(del_path + ".ibd.meta");
}
return true;
}

xb::error() << "prepare_handle_del_files(): failed to delete " << del_path;
xb::error() << "prepare_handle_del_files(): failed to delete " << del_file;
return false;
}
/************************************************************************
Expand Down

0 comments on commit 58a63a6

Please sign in to comment.