Skip to content

Commit c38c114

Browse files
Revert force start with local config (#26304)
1 parent 9c36534 commit c38c114

File tree

2 files changed

+11
-69
lines changed

2 files changed

+11
-69
lines changed

ydb/core/config/init/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,9 +898,9 @@ NKikimrConfig::TAppConfig GetYamlConfigFromResult(const IConfigurationResult& re
898898
return appConfig;
899899
}
900900

901-
TMaybe<NKikimrConfig::TAppConfig> GetActualDynConfig(
901+
NKikimrConfig::TAppConfig GetActualDynConfig(
902902
const NKikimrConfig::TAppConfig& yamlConfig,
903-
const TMaybe<NKikimrConfig::TAppConfig>& regularConfig,
903+
const NKikimrConfig::TAppConfig& regularConfig,
904904
IConfigUpdateTracer& ConfigUpdateTracer)
905905
{
906906
if (yamlConfig.GetYamlConfigEnabled()) {

ydb/core/config/init/init_impl.h

Lines changed: 9 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ struct TCommonAppOptions {
338338
bool SysLogEnabled = false;
339339
bool TcpEnabled = false;
340340
bool SuppressVersionCheck = false;
341-
bool ForceStartWithLocalConfig = false;
342341
EWorkload Workload = EWorkload::Hybrid;
343342
TString BridgePileName;
344343
TString SeedNodesFile;
@@ -348,9 +347,6 @@ struct TCommonAppOptions {
348347
opts.AddLongOption("cluster-name", "which cluster this node belongs to")
349348
.DefaultValue("unknown").OptionalArgument("STR")
350349
.Handler(new TWithDefaultOptHandler(&ClusterName));
351-
opts.AddLongOption("force-start-with-local-config", "enables starting a dynamic node in emergency no-console mode using the configuration from --config-dir or --yaml-config")
352-
.NoArgument()
353-
.SetFlag(&ForceStartWithLocalConfig);
354350
opts.AddLongOption("log-level", "default logging level").OptionalArgument("1-7")
355351
.DefaultValue(ToString(DefaultLogLevel))
356352
.Handler(new TWithDefaultOptHandler(&LogLevel));
@@ -1029,9 +1025,9 @@ ui32 NextValidKind(ui32 kind);
10291025
bool HasCorrespondingManagedKind(ui32 kind, const NKikimrConfig::TAppConfig& appConfig);
10301026
NClient::TKikimr GetKikimr(const TGrpcSslSettings& cf, const TString& addr, const IEnv& env);
10311027
NKikimrConfig::TAppConfig GetYamlConfigFromResult(const IConfigurationResult& result, const TMap<TString, TString>& labels);
1032-
TMaybe<NKikimrConfig::TAppConfig> GetActualDynConfig(
1028+
NKikimrConfig::TAppConfig GetActualDynConfig(
10331029
const NKikimrConfig::TAppConfig& yamlConfig,
1034-
const TMaybe<NKikimrConfig::TAppConfig>& regularConfig,
1030+
const NKikimrConfig::TAppConfig& regularConfig,
10351031
IConfigUpdateTracer& ConfigUpdateTracer);
10361032

10371033
NYdb::TDriverConfig CreateDriverConfig(const TGrpcSslSettings& settings, const TString& addrs, const IEnv& env, const std::optional<TString>& authToken = std::nullopt);
@@ -1054,7 +1050,6 @@ class TInitialConfiguratorImpl
10541050
TString TenantName;
10551051
TString ClusterName;
10561052
TString NodeName;
1057-
TString YamlConfigString;
10581053

10591054
TMap<TString, TString> Labels;
10601055

@@ -1136,14 +1131,6 @@ class TInitialConfiguratorImpl
11361131
if (CommonAppOptions.IsStaticNode()) {
11371132
InitStaticNode();
11381133
} else {
1139-
if (CommonAppOptions.ForceStartWithLocalConfig) {
1140-
if (!FillYamlConfigString(refs)) {
1141-
ythrow yexception() << "When specifying the --force-start-with-local-config option, \
1142-
you should also specify either --config-dir or --yaml-config to indicate where to take the config from";
1143-
}
1144-
} else {
1145-
FillYamlConfigString(refs);
1146-
}
11471134
InitDynamicNode();
11481135
}
11491136

@@ -1391,25 +1378,6 @@ class TInitialConfiguratorImpl
13911378
std::optional<TString> StartupConfigYaml;
13921379
std::optional<TString> StartupStorageYaml;
13931380
};
1394-
bool FillYamlConfigString(TConfigRefs refs, const TString& yamlConfigFile) {
1395-
IProtoConfigFileProvider& protoConfigFileProvider = refs.ProtoConfigFileProvider;
1396-
IErrorCollector& errorCollector = refs.ErrorCollector;
1397-
YamlConfigString = protoConfigFileProvider.GetProtoFromFile(yamlConfigFile, errorCollector);
1398-
return true;
1399-
}
1400-
1401-
bool FillYamlConfigString(TConfigRefs refs) {
1402-
if (CommonAppOptions.ConfigDirPath) {
1403-
auto dir = fs::path(CommonAppOptions.ConfigDirPath.c_str());
1404-
if (auto path = dir / CONFIG_NAME; fs::is_regular_file(path)) {
1405-
return FillYamlConfigString(refs, path.string());
1406-
}
1407-
}
1408-
if (CommonAppOptions.YamlConfigFile) {
1409-
return FillYamlConfigString(refs, CommonAppOptions.YamlConfigFile);
1410-
}
1411-
return false;
1412-
}
14131381

14141382
void InitStaticNode() {
14151383
CommonAppOptions.ValidateStaticNodeConfig();
@@ -1427,33 +1395,6 @@ class TInitialConfiguratorImpl
14271395
ApplyConfigForNode(appConfig);
14281396
}
14291397

1430-
bool ApplyActualDynConfigFromYaml(const NKikimrConfig::TAppConfig& yamlConfig, const TMaybe<NKikimrConfig::TAppConfig>& regularConfigOpt) {
1431-
InitDebug.YamlConfig.CopyFrom(yamlConfig);
1432-
auto appConfig = GetActualDynConfig(yamlConfig, regularConfigOpt, ConfigUpdateTracer);
1433-
if (!appConfig) {
1434-
return false;
1435-
}
1436-
TString message = "Success apply config";
1437-
if (!regularConfigOpt) { // regularConfigOpt is empty when starting a node with the --force-start-with-local-config option
1438-
message += " (force start with local config)";
1439-
}
1440-
Logger.Out() << message << Endl;
1441-
ApplyConfigForNode(*appConfig);
1442-
return true;
1443-
}
1444-
1445-
void StartWithLocalConfig() {
1446-
Logger.Out() << "Try force start with local config" << Endl;
1447-
NKikimrConfig::TAppConfig yamlConfig;
1448-
NYamlConfig::ResolveAndParseYamlConfig(
1449-
YamlConfigString,
1450-
{},
1451-
Labels,
1452-
yamlConfig,
1453-
std::nullopt);
1454-
ApplyActualDynConfigFromYaml(yamlConfig, Nothing());
1455-
}
1456-
14571398
void InitDynamicNode() {
14581399
Labels["dynamic"] = "true";
14591400
Labels["node_kind"] = "dynamic";
@@ -1467,10 +1408,6 @@ class TInitialConfiguratorImpl
14671408
AddLabelToAppConfig("node_name", Labels["node_name"]);
14681409
}
14691410

1470-
if (CommonAppOptions.ForceStartWithLocalConfig) {
1471-
return StartWithLocalConfig();
1472-
}
1473-
14741411
TVector<TString> addrs;
14751412
CommonAppOptions.FillClusterEndpoints(AppConfig, addrs);
14761413

@@ -1486,13 +1423,18 @@ class TInitialConfiguratorImpl
14861423
auto result = DynConfigClient.GetConfig(CommonAppOptions.GrpcSslSettings, addrs, settings, Env, Logger);
14871424

14881425
if (!result) {
1489-
return StartWithLocalConfig();
1426+
return;
14901427
}
14911428

14921429
NKikimrConfig::TAppConfig yamlConfig = GetYamlConfigFromResult(*result, Labels);
14931430
NYamlConfig::ReplaceUnmanagedKinds(result->GetConfig(), yamlConfig);
14941431

1495-
ApplyActualDynConfigFromYaml(yamlConfig, result->GetConfig());
1432+
InitDebug.OldConfig.CopyFrom(result->GetConfig());
1433+
InitDebug.YamlConfig.CopyFrom(yamlConfig);
1434+
1435+
NKikimrConfig::TAppConfig appConfig = GetActualDynConfig(yamlConfig, result->GetConfig(), ConfigUpdateTracer);
1436+
1437+
ApplyConfigForNode(appConfig);
14961438
}
14971439

14981440
void RegisterCliOptions(NLastGetopt::TOpts& opts) override {

0 commit comments

Comments
 (0)