Skip to content

Commit

Permalink
Wait writer (ydb-platform#2935)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberROFL authored Mar 19, 2024
1 parent 7370f61 commit 69bc320
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ydb/public/lib/ydb_cli/dump/restore_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,19 @@ TRestoreResult TRestoreClient::CheckSchema(const TString& dbPath, const TTableDe
return Result<TRestoreResult>();
}

struct TWriterWaiter {
NPrivate::IDataWriter& Writer;

TWriterWaiter(NPrivate::IDataWriter& writer)
: Writer(writer)
{
}

~TWriterWaiter() {
Writer.Wait();
}
};

TRestoreResult TRestoreClient::RestoreData(const TFsPath& fsPath, const TString& dbPath, const TRestoreSettings& settings, const TTableDescription& desc) {
if (desc.GetAttributes().contains(DOC_API_TABLE_VERSION_ATTR) && settings.SkipDocumentTables_) {
return Result<TRestoreResult>();
Expand Down Expand Up @@ -354,6 +367,7 @@ TRestoreResult TRestoreClient::RestoreData(const TFsPath& fsPath, const TString&
}
}

TWriterWaiter waiter(*writer);
ui32 dataFileId = 0;
TFsPath dataFile = fsPath.Child(DataFileName(dataFileId));

Expand Down Expand Up @@ -389,8 +403,6 @@ TRestoreResult TRestoreClient::RestoreData(const TFsPath& fsPath, const TString&
}
}

writer->Wait();

return Result<TRestoreResult>();
}

Expand Down

0 comments on commit 69bc320

Please sign in to comment.