@@ -338,7 +338,6 @@ struct TCommonAppOptions {
338
338
bool SysLogEnabled = false ;
339
339
bool TcpEnabled = false ;
340
340
bool SuppressVersionCheck = false ;
341
- bool ForceStartWithLocalConfig = false ;
342
341
EWorkload Workload = EWorkload::Hybrid;
343
342
TString BridgePileName;
344
343
TString SeedNodesFile;
@@ -348,9 +347,6 @@ struct TCommonAppOptions {
348
347
opts.AddLongOption (" cluster-name" , " which cluster this node belongs to" )
349
348
.DefaultValue (" unknown" ).OptionalArgument (" STR" )
350
349
.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);
354
350
opts.AddLongOption (" log-level" , " default logging level" ).OptionalArgument (" 1-7" )
355
351
.DefaultValue (ToString (DefaultLogLevel))
356
352
.Handler (new TWithDefaultOptHandler (&LogLevel));
@@ -1029,9 +1025,9 @@ ui32 NextValidKind(ui32 kind);
1029
1025
bool HasCorrespondingManagedKind (ui32 kind, const NKikimrConfig::TAppConfig& appConfig);
1030
1026
NClient::TKikimr GetKikimr (const TGrpcSslSettings& cf, const TString& addr, const IEnv& env);
1031
1027
NKikimrConfig::TAppConfig GetYamlConfigFromResult (const IConfigurationResult& result, const TMap<TString, TString>& labels);
1032
- TMaybe< NKikimrConfig::TAppConfig> GetActualDynConfig (
1028
+ NKikimrConfig::TAppConfig GetActualDynConfig (
1033
1029
const NKikimrConfig::TAppConfig& yamlConfig,
1034
- const TMaybe< NKikimrConfig::TAppConfig> & regularConfig,
1030
+ const NKikimrConfig::TAppConfig& regularConfig,
1035
1031
IConfigUpdateTracer& ConfigUpdateTracer);
1036
1032
1037
1033
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
1054
1050
TString TenantName;
1055
1051
TString ClusterName;
1056
1052
TString NodeName;
1057
- TString YamlConfigString;
1058
1053
1059
1054
TMap<TString, TString> Labels;
1060
1055
@@ -1136,14 +1131,6 @@ class TInitialConfiguratorImpl
1136
1131
if (CommonAppOptions.IsStaticNode ()) {
1137
1132
InitStaticNode ();
1138
1133
} 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
- }
1147
1134
InitDynamicNode ();
1148
1135
}
1149
1136
@@ -1391,25 +1378,6 @@ class TInitialConfiguratorImpl
1391
1378
std::optional<TString> StartupConfigYaml;
1392
1379
std::optional<TString> StartupStorageYaml;
1393
1380
};
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
- }
1413
1381
1414
1382
void InitStaticNode () {
1415
1383
CommonAppOptions.ValidateStaticNodeConfig ();
@@ -1427,33 +1395,6 @@ class TInitialConfiguratorImpl
1427
1395
ApplyConfigForNode (appConfig);
1428
1396
}
1429
1397
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
-
1457
1398
void InitDynamicNode () {
1458
1399
Labels[" dynamic" ] = " true" ;
1459
1400
Labels[" node_kind" ] = " dynamic" ;
@@ -1467,10 +1408,6 @@ class TInitialConfiguratorImpl
1467
1408
AddLabelToAppConfig (" node_name" , Labels[" node_name" ]);
1468
1409
}
1469
1410
1470
- if (CommonAppOptions.ForceStartWithLocalConfig ) {
1471
- return StartWithLocalConfig ();
1472
- }
1473
-
1474
1411
TVector<TString> addrs;
1475
1412
CommonAppOptions.FillClusterEndpoints (AppConfig, addrs);
1476
1413
@@ -1486,13 +1423,18 @@ class TInitialConfiguratorImpl
1486
1423
auto result = DynConfigClient.GetConfig (CommonAppOptions.GrpcSslSettings , addrs, settings, Env, Logger);
1487
1424
1488
1425
if (!result) {
1489
- return StartWithLocalConfig () ;
1426
+ return ;
1490
1427
}
1491
1428
1492
1429
NKikimrConfig::TAppConfig yamlConfig = GetYamlConfigFromResult (*result, Labels);
1493
1430
NYamlConfig::ReplaceUnmanagedKinds (result->GetConfig (), yamlConfig);
1494
1431
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);
1496
1438
}
1497
1439
1498
1440
void RegisterCliOptions (NLastGetopt::TOpts& opts) override {
0 commit comments