Skip to content

Commit cdbb0bc

Browse files
authored
Simplify BackupReplication (#14466)
1 parent 1bd8df7 commit cdbb0bc

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

ydb/library/backup/backup.cpp

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -725,18 +725,7 @@ inline TString Interval(const TDuration& value) {
725725
return TStringBuilder() << "Interval('PT" << value.Seconds() << "S')";
726726
}
727727

728-
TString BuildCreateReplicationQuery(
729-
const TString& name,
730-
const TString& dbPath,
731-
const NReplication::TReplicationDescription& desc,
732-
const TString& backupRoot,
733-
NYql::TIssues& issues)
734-
{
735-
// TODO(ilnaz)
736-
Y_UNUSED(dbPath);
737-
Y_UNUSED(backupRoot);
738-
Y_UNUSED(issues);
739-
728+
TString BuildCreateReplicationQuery(const TString& name, const NReplication::TReplicationDescription& desc) {
740729
TVector<TString> targets(::Reserve(desc.GetItems().size()));
741730
for (const auto& item : desc.GetItems()) {
742731
if (!item.DstPath.ends_with("/indexImplTable")) { // TODO(ilnaz): get rid of this hack
@@ -769,22 +758,12 @@ TString BuildCreateReplicationQuery(
769758

770759
}
771760

772-
void BackupReplication(
773-
TDriver driver,
774-
const TString& dbBackupRoot,
775-
const TString& dbPathRelativeToBackupRoot,
776-
const TFsPath& fsBackupFolder,
777-
NYql::TIssues& issues)
778-
{
779-
Y_ENSURE(!dbPathRelativeToBackupRoot.empty());
780-
const auto dbPath = JoinDatabasePath(dbBackupRoot, dbPathRelativeToBackupRoot);
781-
761+
void BackupReplication(TDriver driver, const TString& dbPath, const TFsPath& fsBackupFolder) {
762+
Y_ENSURE(!dbPath.empty());
782763
LOG_I("Backup async replication " << dbPath.Quote() << " to " << fsBackupFolder.GetPath().Quote());
783764

784-
const auto name = TFsPath(dbPathRelativeToBackupRoot).GetName();
785765
const auto desc = DescribeReplication(driver, dbPath);
786-
const auto creationQuery = BuildCreateReplicationQuery(name, dbPath, desc, dbBackupRoot, issues);
787-
Y_ENSURE(creationQuery, issues.ToString());
766+
const auto creationQuery = BuildCreateReplicationQuery(fsBackupFolder.GetName(), desc);
788767

789768
WriteCreationQueryToFile(creationQuery, fsBackupFolder, NDump::NFiles::CreateAsyncReplication());
790769
BackupPermissions(driver, dbPath, fsBackupFolder);
@@ -884,7 +863,7 @@ void BackupFolderImpl(TDriver driver, const TString& dbPrefix, const TString& ba
884863
BackupCoordinationNode(driver, dbIt.GetFullPath(), childFolderPath);
885864
}
886865
if (dbIt.IsReplication()) {
887-
BackupReplication(driver, dbIt.GetTraverseRoot(), dbIt.GetRelPath(), childFolderPath, issues);
866+
BackupReplication(driver, dbIt.GetFullPath(), childFolderPath);
888867
}
889868
dbIt.Next();
890869
}

0 commit comments

Comments
 (0)