Skip to content

Commit

Permalink
export: finish and pass away instead of reportError
Browse files Browse the repository at this point in the history
  • Loading branch information
jepett0 committed Jan 22, 2025
1 parent fd7d697 commit a9c1d8e
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions ydb/core/tx/schemeshard/schemeshard_export_scheme_uploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,19 @@ class TSchemeUploader: public TActorBootstrapped<TSchemeUploader> {
<< ", status: " << describeResult.GetStatus()
);

auto reportError = [&](const TString& error) {
Send(SchemeShard, new TEvPrivate::TEvExportSchemeUploadResult(
ExportId, ItemIdx, false, error
));
};

if (describeResult.GetStatus() != TEvSchemeShard::EStatus::StatusSuccess) {
reportError(describeResult.GetReason());
return;
return Finish(false, describeResult.GetReason());
}

TString error;
if (!BuildSchemeToUpload(describeResult, error)) {
reportError(error);
return;
return Finish(false, error);
}

if (auto permissions = NDataShard::GenYdbPermissions(describeResult.GetPathDescription())) {
google::protobuf::TextFormat::PrintToString(permissions.GetRef(), &Permissions);
} else {
reportError("cannot infer permissions");
return;
return Finish(false, "cannot infer permissions");
}

UploadScheme();
Expand Down Expand Up @@ -254,24 +245,19 @@ class TSchemeUploader: public TActorBootstrapped<TSchemeUploader> {

void Bootstrap() {
if (!DestinationPrefix) {
Finish(false, TStringBuilder() << "cannot determine destination prefix, item index: " << ItemIdx << " out of range");
return;
return Finish(false, TStringBuilder() << "cannot determine destination prefix, item index: " << ItemIdx << " out of range");
}
if (!Scheme || !Permissions) {
GetDescription();
return;
return GetDescription();
}
if (!SchemeUploaded) {
UploadScheme();
return;
return UploadScheme();
}
if (!PermissionsUploaded) {
UploadPermissions();
return;
return UploadPermissions();
}
if (!MetadataUploaded) {
UploadMetadata();
return;
return UploadMetadata();
}
Finish();
}
Expand Down

0 comments on commit a9c1d8e

Please sign in to comment.