Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jepett0 committed Feb 7, 2025
1 parent 4cddcb7 commit 668d0a4
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions ydb/public/lib/ydb_cli/dump/restore_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ydb/public/lib/ydb_cli/dump/util/view_utils.h>
#include <ydb-cpp-sdk/client/proto/accessor.h>

#include <util/generic/deque.h>
#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
#include <util/generic/maybe.h>
Expand All @@ -29,6 +30,7 @@ namespace NYdb::NDump {
using namespace NConsoleClient;
using namespace NImport;
using namespace NOperation;
using namespace NRateLimiter;
using namespace NScheme;
using namespace NTable;
using namespace NTopic;
Expand Down Expand Up @@ -187,15 +189,15 @@ TStatus CreateCoordinationNode(
}

TStatus CreateResource(
NRateLimiter::TRateLimiterClient& client,
TRateLimiterClient& client,
const std::string& coordinationNodePath,
const std::string& resourcePath,
const Ydb::RateLimiter::CreateResourceRequest& request)
{
// to do: use the request
// const auto settings = NRateLimiter::TCreateResourceSettings(request);
// const auto settings = TCreateResourceSettings(request);
Y_UNUSED(request);
NRateLimiter::TCreateResourceSettings settings;
TCreateResourceSettings settings;
auto result = RetryFunction([&]() {
return client.CreateResource(coordinationNodePath, resourcePath, settings).ExtractValueSync();
});
Expand Down Expand Up @@ -598,15 +600,23 @@ TRestoreResult TRestoreClient::RestoreResource(
TRestoreResult TRestoreClient::RestoreDependentResources(const TFsPath& fsPath, const TString& dbPath) {
LOG_I("Restore coordination node's resources " << fsPath.GetPath().Quote() << " to " << dbPath.Quote());

TVector<TFsPath> resources;
fsPath.List(resources);
for (const auto& resourceFsPath : resources) {
if (IsFileExists(resourceFsPath.Child(NFiles::CreateResource().FileName))) {
auto result = RestoreResource(resourceFsPath, dbPath, resourceFsPath.RelativeTo(fsPath).GetPath());
if (!result.IsSuccess()) {
return result;
TVector<TFsPath> children;
fsPath.List(children);
TDeque<TFsPath> pathQueue(children.begin(), children.end());
while (!pathQueue.empty()) {
const auto path = pathQueue.front();
pathQueue.pop_front();
if (path.IsDirectory()) {
if (IsFileExists(path.Child(NFiles::CreateResource().FileName))) {
auto result = RestoreResource(path, dbPath, path.RelativeTo(fsPath).GetPath());
if (!result.IsSuccess()) {
return result;
}
} else {
// to do: list children and add them to the queue
}
}

}
return Result<TRestoreResult>();
}
Expand Down

0 comments on commit 668d0a4

Please sign in to comment.