Skip to content

Commit 377c8ea

Browse files
authored
Cosmetic changes (#14507)
1 parent 4fee494 commit 377c8ea

14 files changed

+44
-60
lines changed

ydb/public/lib/ydb_cli/dump/dump.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
#include <util/string/printf.h>
1010

11-
namespace NYdb {
12-
namespace NDump {
11+
namespace NYdb::NDump {
1312

1413
TString DataFileName(ui32 id) {
1514
return Sprintf("data_%02d.csv", id);
@@ -85,5 +84,4 @@ TDumpResult TClient::DumpDatabase(const TString& database, const TString& fsPath
8584
return Impl_->DumpDatabase(database, fsPath);
8685
}
8786

88-
} // NDump
89-
} // NYdb
87+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/dump.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TLog;
1313
namespace NYdb {
1414

1515
inline namespace V3 {
16-
class TDriver;
16+
class TDriver;
1717
}
1818

1919
namespace NDump {

ydb/public/lib/ydb_cli/dump/dump_impl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include <ydb/library/backup/util.h>
55
#include <ydb/public/lib/ydb_cli/dump/util/util.h>
66

7-
namespace NYdb {
8-
namespace NDump {
7+
namespace NYdb::NDump {
98

109
TDumpClient::TDumpClient(const TDriver& driver, const std::shared_ptr<TLog>& log)
1110
: Driver(driver)
@@ -60,5 +59,4 @@ TDumpResult TDumpClient::DumpDatabase(const TString& database, const TString& fs
6059
}
6160
}
6261

63-
} // NDump
64-
} // NYdb
62+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/dump_impl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "dump.h"
44

5-
namespace NYdb {
6-
namespace NDump {
5+
namespace NYdb::NDump {
76

87
class TDumpClient {
98
public:
@@ -21,5 +20,4 @@ class TDumpClient {
2120

2221
}; // TDumpClient
2322

24-
} // NDump
25-
} // NYdb
23+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/restore_compat.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#include <ydb/library/backup/query_builder.h>
44
#include <ydb/library/backup/query_uploader.h>
55

6-
namespace NYdb {
7-
namespace NDump {
6+
namespace NYdb::NDump {
87

98
using namespace NBackup;
109
using namespace NTable;
@@ -183,5 +182,4 @@ NPrivate::IDataWriter* CreateCompatWriter(
183182
return new TDataWriter(path, tableClient, accumulator, settings);
184183
}
185184

186-
} // NDump
187-
} // NYdb
185+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/restore_compat.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "restore_impl.h"
44

5-
namespace NYdb {
6-
namespace NDump {
5+
namespace NYdb::NDump {
76

87
NPrivate::IDataAccumulator* CreateCompatAccumulator(
98
const TString& path,
@@ -16,5 +15,4 @@ NPrivate::IDataWriter* CreateCompatWriter(
1615
const NPrivate::IDataAccumulator* accumulator,
1716
const TRestoreSettings& settings);
1817

19-
} // NDump
20-
} // NYdb
18+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/restore_impl.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ TStatus CreateCoordinationNode(
218218

219219
TStatus CreateRateLimiter(
220220
TRateLimiterClient& client,
221-
const std::string& coordinationNodePath,
222-
const std::string& rateLimiterPath,
221+
const TString& coordinationNodePath,
222+
const TString& rateLimiterPath,
223223
const Ydb::RateLimiter::CreateResourceRequest& request)
224224
{
225225
const auto settings = TCreateResourceSettings(request);
@@ -540,6 +540,10 @@ TRestoreResult TRestoreClient::RestoreView(
540540
const TString dbPath = dbRestoreRoot + dbPathRelativeToRestoreRoot;
541541
LOG_I("Restore view " << fsPath.GetPath().Quote() << " to " << dbPath.Quote());
542542

543+
if (settings.DryRun_) {
544+
return CheckExistenceAndType(SchemeClient, dbPath, ESchemeEntryType::View);
545+
}
546+
543547
TString query = ReadViewQuery(fsPath, Log.get());
544548

545549
NYql::TIssues issues;
@@ -548,11 +552,6 @@ TRestoreResult TRestoreClient::RestoreView(
548552
return Result<TRestoreResult>(fsPath.GetPath(), EStatus::BAD_REQUEST, issues.ToString());
549553
}
550554

551-
if (settings.DryRun_) {
552-
return CheckExistenceAndType(SchemeClient, dbPath, ESchemeEntryType::View);
553-
}
554-
555-
LOG_D("Executing view creation query: " << query.Quote());
556555
auto result = QueryClient.RetryQuerySync([&](NQuery::TSession session) {
557556
return session.ExecuteQuery(query, NQuery::TTxControl::NoTx()).ExtractValueSync();
558557
});
@@ -592,8 +591,8 @@ TRestoreResult TRestoreClient::RestoreTopic(
592591
return CheckExistenceAndType(SchemeClient, dbPath, ESchemeEntryType::Topic);
593592
}
594593

595-
const auto creationRequest = ReadTopicCreationRequest(fsPath, Log.get());
596-
auto result = CreateTopic(TopicClient, dbPath, creationRequest);
594+
const auto request = ReadTopicCreationRequest(fsPath, Log.get());
595+
auto result = CreateTopic(TopicClient, dbPath, request);
597596
if (result.IsSuccess()) {
598597
LOG_D("Created " << dbPath.Quote());
599598
return RestorePermissions(fsPath, dbPath, settings, isAlreadyExisting);
@@ -657,8 +656,8 @@ TRestoreResult TRestoreClient::RestoreRateLimiter(
657656
return *error;
658657
}
659658

660-
const auto creationRequest = ReadRateLimiterCreationRequest(fsPath, Log.get());
661-
auto result = CreateRateLimiter(RateLimiterClient, coordinationNodePath, rateLimiterPath, creationRequest);
659+
const auto request = ReadRateLimiterCreationRequest(fsPath, Log.get());
660+
auto result = CreateRateLimiter(RateLimiterClient, coordinationNodePath, rateLimiterPath, request);
662661
if (result.IsSuccess()) {
663662
LOG_D("Created rate limiter: " << rateLimiterPath.Quote()
664663
<< " dependent on the coordination node: " << coordinationNodePath.Quote()
@@ -669,37 +668,36 @@ TRestoreResult TRestoreClient::RestoreRateLimiter(
669668
LOG_E("Failed to create rate limiter: " << rateLimiterPath.Quote()
670669
<< " dependent on the coordination node: " << coordinationNodePath.Quote()
671670
);
672-
return Result<TRestoreResult>(JoinFsPaths(coordinationNodePath, rateLimiterPath), std::move(result));
671+
return Result<TRestoreResult>(Join("/", coordinationNodePath, rateLimiterPath), std::move(result));
673672
}
674673

675-
TRestoreResult TRestoreClient::RestoreDependentResources(
676-
const TFsPath& coordinationNodeFsPath, const TString& coordinationNodeDbPath)
677-
{
678-
LOG_I("Restore coordination node's resources " << coordinationNodeFsPath.GetPath().Quote()
679-
<< " to " << coordinationNodeDbPath.Quote()
674+
TRestoreResult TRestoreClient::RestoreDependentResources(const TFsPath& fsPath, const TString& dbPath) {
675+
LOG_I("Restore coordination node's resources " << fsPath.GetPath().Quote()
676+
<< " to " << dbPath.Quote()
680677
);
681678

682679
TVector<TFsPath> children;
683-
coordinationNodeFsPath.List(children);
680+
fsPath.List(children);
684681
TDeque<TFsPath> pathQueue(children.begin(), children.end());
685682
while (!pathQueue.empty()) {
686683
const auto path = pathQueue.front();
687684
pathQueue.pop_front();
685+
688686
if (path.IsDirectory()) {
689687
if (IsFileExists(path.Child(NFiles::CreateRateLimiter().FileName))) {
690-
const auto result = RestoreRateLimiter(
691-
path, coordinationNodeDbPath, path.RelativeTo(coordinationNodeFsPath).GetPath()
692-
);
688+
const auto result = RestoreRateLimiter(path, dbPath, path.RelativeTo(fsPath).GetPath());
693689
if (!result.IsSuccess()) {
694690
return result;
695691
}
696692
}
693+
697694
children.clear();
698695
path.List(children);
699696
pathQueue.insert(pathQueue.end(), children.begin(), children.end());
700697
}
701698

702699
}
700+
703701
return Result<TRestoreResult>();
704702
}
705703

@@ -721,16 +719,18 @@ TRestoreResult TRestoreClient::RestoreCoordinationNode(
721719
return CheckExistenceAndType(SchemeClient, dbPath, ESchemeEntryType::CoordinationNode);
722720
}
723721

724-
const auto creationRequest = ReadCoordinationNodeCreationRequest(fsPath, Log.get());
725-
auto result = CreateCoordinationNode(CoordinationNodeClient, dbPath, creationRequest);
722+
const auto request = ReadCoordinationNodeCreationRequest(fsPath, Log.get());
723+
auto result = CreateCoordinationNode(CoordinationNodeClient, dbPath, request);
726724
if (result.IsSuccess()) {
727725
if (auto result = RestoreDependentResources(fsPath, dbPath); !result.IsSuccess()) {
728726
LOG_E("Failed to create coordination node's resources " << dbPath.Quote());
729727
return Result<TRestoreResult>(dbPath, std::move(result));
730728
}
729+
731730
LOG_D("Created " << dbPath.Quote());
732731
return RestorePermissions(fsPath, dbPath, settings, isAlreadyExisting);
733732
}
733+
734734
LOG_E("Failed to create " << dbPath.Quote());
735735
return Result<TRestoreResult>(dbPath, std::move(result));
736736
}

ydb/public/lib/ydb_cli/dump/restore_impl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#include <util/stream/fwd.h>
1717
#include <util/string/builder.h>
1818

19-
namespace NYdb {
20-
namespace NDump {
19+
namespace NYdb::NDump {
2120

2221
extern const char DOC_API_TABLE_VERSION_ATTR[23];
2322
extern const char DOC_API_REQUEST_TYPE[22];
@@ -179,5 +178,4 @@ class TRestoreClient {
179178

180179
}; // TRestoreClient
181180

182-
} // NDump
183-
} // NYdb
181+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/restore_import_data.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
#include <util/system/mutex.h>
2323
#include <util/thread/pool.h>
2424

25-
namespace NYdb {
26-
namespace NDump {
25+
namespace NYdb::NDump {
2726

2827
using namespace NImport;
2928
using namespace NTable;
@@ -1007,5 +1006,4 @@ NPrivate::IDataWriter* CreateImportDataWriter(
10071006
return new TDataWriter(path, desc, partitionCount, settings, importClient, tableClient, accumulators, log);
10081007
}
10091008

1010-
} // NDump
1011-
} // NYdb
1009+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/restore_import_data.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
class TLog;
66

7-
namespace NYdb {
8-
namespace NDump {
7+
namespace NYdb::NDump {
98

109
NPrivate::IDataAccumulator* CreateImportDataAccumulator(
1110
const NTable::TTableDescription& dumpedDesc,
@@ -23,5 +22,4 @@ NPrivate::IDataWriter* CreateImportDataWriter(
2322
const TRestoreSettings& settings,
2423
const std::shared_ptr<TLog>& log);
2524

26-
} // NDump
27-
} // NYdb
25+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/util/query_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ bool RewriteCreateQuery(TString& query, std::string_view pattern, const std::str
2929
TString GetBackupRoot(const TString& query);
3030
TString GetDatabase(const TString& query);
3131

32-
}
32+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/util/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ TGetDatabaseStatusResult GetDatabaseStatus(TCmsClient& cmsClient, const std::str
5959
});
6060
}
6161

62-
}
62+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/util/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ NCms::TGetDatabaseStatusResult GetDatabaseStatus(
7171
const std::string& path,
7272
const NCms::TGetDatabaseStatusSettings& settings = {});
7373

74-
} // namespace NYDB::NDump
74+
} // NYdb::NDump

ydb/public/lib/ydb_cli/dump/util/view_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ bool RewriteCreateViewQuery(TString& query, const TString& restoreRoot, bool res
1717
const TString& dbPath, NYql::TIssues& issues
1818
);
1919

20-
}
20+
} // NYdb::NDump

0 commit comments

Comments
 (0)