diff --git a/ydb/public/lib/ydb_cli/dump/restore_impl.cpp b/ydb/public/lib/ydb_cli/dump/restore_impl.cpp index 382cd71c6a47..db4fde4ea270 100644 --- a/ydb/public/lib/ydb_cli/dump/restore_impl.cpp +++ b/ydb/public/lib/ydb_cli/dump/restore_impl.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -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; @@ -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(); }); @@ -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 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 children; + fsPath.List(children); + TDeque 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(); }