Skip to content
Open

WIP #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ydb/core/tx/schemeshard/schemeshard__backup_collection_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ std::optional<NBackup::TBackupCollectionPaths> ResolveBackupCollectionPaths(

const TString& backupCollectionsDir = JoinPath({rootPath.GetDomainPathString(), ".backups/collections"});

// Validate the collection name
if (name.empty()) {
result->SetError(NKikimrScheme::EStatus::StatusInvalidParameter, "Backup collection name cannot be empty");
return std::nullopt;
}

TPathSplitUnix absPathSplit(name);

if (absPathSplit.size() > 1 && !absPathSplit.IsAbsolute) {
Expand Down Expand Up @@ -104,7 +110,10 @@ std::optional<THashMap<TString, THashSet<TString>>> GetBackupRequiredPaths(
}
}

Y_ABORT_UNLESS(context.SS->BackupCollections.contains(bcPath->PathId));
// Check if backup collection still exists in memory (may have been dropped)
if (!context.SS->BackupCollections.contains(bcPath->PathId)) {
return {};
}
const auto& bc = context.SS->BackupCollections[bcPath->PathId];

auto& collectionPaths = paths[targetPath];
Expand Down Expand Up @@ -153,7 +162,10 @@ std::optional<THashMap<TString, THashSet<TString>>> GetRestoreRequiredPaths(
}
}

Y_ABORT_UNLESS(context.SS->BackupCollections.contains(bcPath->PathId));
// Check if backup collection still exists in memory (may have been dropped)
if (!context.SS->BackupCollections.contains(bcPath->PathId)) {
return {};
}
const auto& bc = context.SS->BackupCollections[bcPath->PathId];

auto& collectionPaths = paths[tx.GetWorkingDir()];
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard__operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ TVector<ISubOperation::TPtr> TDefaultOperationFactory::MakeOperationParts(
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterBackupCollection:
Y_ABORT("TODO: implement");
case NKikimrSchemeOp::EOperationType::ESchemeOpDropBackupCollection:
return {CreateDropBackupCollection(op.NextPartId(), tx)};
return CreateDropBackupCollection(op.NextPartId(), tx, context);

case NKikimrSchemeOp::EOperationType::ESchemeOpBackupBackupCollection:
return CreateBackupBackupCollection(op.NextPartId(), tx, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ TVector<ISubOperation::TPtr> CreateBackupBackupCollection(TOperationId opId, con
}
}

Y_ABORT_UNLESS(context.SS->BackupCollections.contains(bcPath->PathId));
// Check if backup collection still exists in memory (may have been dropped)
if (!context.SS->BackupCollections.contains(bcPath->PathId)) {
result = {CreateReject(opId, NKikimrScheme::StatusPathDoesNotExist, "Backup collection no longer exists")};
return result;
}
const auto& bc = context.SS->BackupCollections[bcPath->PathId];
bool incrBackupEnabled = bc->Description.HasIncrementalBackupConfig();
TString streamName = NBackup::ToX509String(TlsActivationContext->AsActorContext().Now()) + "_continuousBackupImpl";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ TVector<ISubOperation::TPtr> CreateBackupIncrementalBackupCollection(TOperationI
}
}

Y_ABORT_UNLESS(context.SS->BackupCollections.contains(bcPath->PathId));
// Check if backup collection still exists in memory (may have been dropped)
if (!context.SS->BackupCollections.contains(bcPath->PathId)) {
result = {CreateReject(opId, NKikimrScheme::StatusPathDoesNotExist, "Backup collection no longer exists")};
return result;
}
const auto& bc = context.SS->BackupCollections[bcPath->PathId];
bool incrBackupEnabled = bc->Description.HasIncrementalBackupConfig();

Expand Down
Loading