Skip to content

Commit

Permalink
PXB-3380 Addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Aibek Bukabayev committed Oct 11, 2024
1 parent 022a5be commit e048e90
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions storage/innobase/xtrabackup/src/ddl_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,15 @@ typedef struct {
* @param node File node of a tablespace
* @return A string representing the destination name
*/
std::string get_dest_name(fil_node_t *node) {
std::string get_dest_name(const fil_node_t *node) {
std::string path{node->name};
auto last_separator_pos = path.find_last_of(Fil_path::SEPARATOR);

std::string db_name = path.substr(0, last_separator_pos);
std::string space_name = path.substr(last_separator_pos + 1);

ut_ad(space_name.size() > 0);

if (!fsp_is_file_per_table(node->space->id, node->space->flags)) {
return space_name + EXT_NEW;
}
Expand All @@ -315,6 +317,8 @@ std::string get_dest_name(fil_node_t *node) {
db_name = db_name.substr(last_separator_pos + 1);
}

ut_ad(db_name.size() > 0);

return db_name + '/' + space_name + EXT_NEW;
}

Expand All @@ -338,10 +342,8 @@ static void copy_for_reduced(copy_thread_ctxt_t *ctxt) {
}
// Get destination name for the datafile
std::string dest_name = get_dest_name(node);
char dest_name_buffer[FN_REFLEN];
snprintf(dest_name_buffer, FN_REFLEN, "%s", dest_name.c_str());

if (xtrabackup_copy_datafile_func(node, num, dest_name_buffer)) {
if (xtrabackup_copy_datafile_func(node, num, dest_name.c_str())) {
xb::error() << "failed to copy datafile " << node->name;
*(ctxt->error) = true;
}
Expand Down

0 comments on commit e048e90

Please sign in to comment.