Skip to content

Commit a22835a

Browse files
authored
Print expected cluster & version mismatches on configure (#16869)
1 parent 3321dfa commit a22835a

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

ydb/core/cms/console/console__drop_yaml_config.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ class TConfigsManager::TTxDropYamlConfig : public TTransactionBase<TConfigsManag
3232
}
3333

3434
if (Self->ClusterName != cluster) {
35-
ythrow yexception() << "ClusterName mismatch";
35+
ythrow yexception() << "ClusterName mismatch"
36+
<< " expected " << Self->ClusterName
37+
<< " but got " << cluster;
3638
}
3739

3840
if (Version != Self->YamlVersion) {
39-
ythrow yexception() << "Version mismatch";
41+
ythrow yexception() << "Version mismatch"
42+
<< " expected " << Self->YamlVersion
43+
<< " but got " << Version;
4044
}
4145
} catch (const yexception& ex) {
4246
Error = true;

ydb/core/cms/console/console_configs_manager.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ void TConfigsManager::ValidateMainConfig(TUpdateConfigOpContext& opCtx) {
7979
auto resolved = NYamlConfig::ResolveAll(tree);
8080

8181
if (ClusterName != opCtx.Cluster) {
82-
ythrow yexception() << "ClusterName mismatch";
82+
ythrow yexception() << "ClusterName mismatch"
83+
<< " expected " << ClusterName
84+
<< " but got " << opCtx.Cluster;
8385
}
8486

8587
if (opCtx.Version != YamlVersion) {
86-
ythrow yexception() << "Version mismatch";
88+
ythrow yexception() << "Version mismatch"
89+
<< " expected " << YamlVersion
90+
<< " but got " << opCtx.Version;
8791
}
8892

8993
TSimpleSharedPtr<NYamlConfig::TBasicUnknownFieldsCollector> unknownFieldsCollector = new NYamlConfig::TBasicUnknownFieldsCollector;
@@ -1073,11 +1077,15 @@ void TConfigsManager::Handle(TEvConsole::TEvAddVolatileConfigRequest::TPtr &ev,
10731077
}
10741078

10751079
if (ClusterName != clusterName) {
1076-
ythrow yexception() << "ClusterName mismatch";
1080+
ythrow yexception() << "ClusterName mismatch"
1081+
<< " expected " << ClusterName
1082+
<< " but got " << clusterName;
10771083
}
10781084

10791085
if (YamlVersion != version) {
1080-
ythrow yexception() << "Version mismatch";
1086+
ythrow yexception() << "Version mismatch"
1087+
<< " expected " << YamlVersion
1088+
<< " but got " << version;
10811089
}
10821090

10831091
VolatileYamlConfigs.try_emplace(id, cfg);
@@ -1108,11 +1116,15 @@ void TConfigsManager::Handle(TEvConsole::TEvRemoveVolatileConfigRequest::TPtr &e
11081116
try {
11091117
if (!rec.force()) {
11101118
if (ClusterName != rec.identity().cluster()) {
1111-
ythrow yexception() << "ClusterName mismatch";
1119+
ythrow yexception() << "ClusterName mismatch"
1120+
<< " expected " << ClusterName
1121+
<< " but got " << rec.identity().cluster();
11121122
}
11131123

11141124
if (YamlVersion != rec.identity().version()) {
1115-
ythrow yexception() << "Version mismatch";
1125+
ythrow yexception() << "Version mismatch"
1126+
<< " expected " << YamlVersion
1127+
<< " but got " << rec.identity().version();
11161128
}
11171129
}
11181130

0 commit comments

Comments
 (0)