aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInnokentii Mokin <innokentii@ydb.tech>2024-01-31 00:03:06 +0300
committerGitHub <noreply@github.com>2024-01-31 00:03:06 +0300
commiteabb0f0cc24c9572fb70f5769d2fb8dddcfefaf4 (patch)
tree4e3af46a23b9aa099fa19bb33299d977db02d97b
parent27e909566c6ad5df05f0352851fd8c77c7b0205d (diff)
downloadydb-eabb0f0cc24c9572fb70f5769d2fb8dddcfefaf4.tar.gz
Remove outdated ydbd server options (#1433)
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp192
-rw-r--r--ydb/tests/functional/cms_config_cache/main.py93
-rw-r--r--ydb/tests/functional/cms_config_cache/ya.make24
-rw-r--r--ydb/tests/functional/ya.make1
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py11
5 files changed, 4 insertions, 317 deletions
diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
index b7a8f9df61..015bbd0a79 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
@@ -82,7 +82,6 @@ protected:
bool NodeBrokerUseTls;
bool FixedNodeID;
bool IgnoreCmsConfigs;
- bool HierarchicalCfg;
bool TinyMode;
TString NodeAddress;
TString NodeHost;
@@ -260,8 +259,6 @@ protected:
config.Opts->AddLongOption("body", "body name (used to describe dynamic node location)")
.RequiredArgument("NUM").StoreResult(&Body);
config.Opts->AddLongOption("yaml-config", "Yaml config").OptionalArgument("PATH").AppendTo(&YamlConfigFiles);
- config.Opts->AddLongOption("cms-config-cache-file", "Path to CMS cache config file").OptionalArgument("PATH")
- .StoreResult(&RunConfig.PathToConfigCacheFile);
config.Opts->AddLongOption("http-proxy-file", "Http proxy config file").OptionalArgument("PATH");
config.Opts->AddLongOption("public-http-file", "Public HTTP config file").OptionalArgument("PATH");
@@ -278,9 +275,6 @@ protected:
ProxyBusSessionConfig.ConfigureLastGetopt(*config.Opts, "mbus-");
ProxyBusQueueConfig.ConfigureLastGetopt(*config.Opts, "mbus-");
- config.Opts->AddLongOption("hierarchic-cfg", "Use hierarchical approach for configuration parts overriding")
- .NoArgument().SetFlag(&HierarchicalCfg);
-
config.Opts->AddLongOption("label", "labels for this node")
.Optional().RequiredArgument("KEY=VALUE")
.KVHandler([&](TString key, TString val) {
@@ -299,7 +293,7 @@ protected:
ui32 kind,
TCallContext callCtx) {
TProto *res = nullptr;
- if (!HierarchicalCfg && (AppConfig.*hasConfig)()) {
+ if ((AppConfig.*hasConfig)()) {
return nullptr; // this field is already provided in AppConfig, so we don't overwrite it
}
@@ -374,7 +368,7 @@ protected:
(ui32)NKikimrConsole::TConfigItem:: FIELD ## Item, TCallContext{__FILE__, __LINE__})
OPTION("auth-file", AuthConfig);
- LoadBaseConfig(config);
+ LoadBootstrapConfig(config);
LoadYamlConfig(CALL_CTX());
OPTION_MERGE("auth-token-file", AuthConfig);
@@ -453,17 +447,15 @@ protected:
if (!NodeId) {
ythrow yexception() << "Either --node [NUM|'static'] or --node-broker[-port] should be specified";
}
-
- if (!HierarchicalCfg && RunConfig.PathToConfigCacheFile)
- LoadCachedConfigsForStaticNode();
} else {
RegisterDynamicNode();
RunConfig.Labels["node_id"] = ToString(RunConfig.NodeId);
AddLabelToAppConfig("node_id", RunConfig.Labels["node_id"]);
- if (!HierarchicalCfg && !IgnoreCmsConfigs)
+ if (!IgnoreCmsConfigs) {
LoadConfigForDynamicNode();
+ }
}
LoadYamlConfig(CALL_CTX());
@@ -830,96 +822,6 @@ protected:
RunConfig.ClusterName = AppConfig.GetNameserviceConfig().GetClusterUUID();
}
- inline bool LoadConfigFromCMS() {
- TVector<TString> addrs;
- FillClusterEndpoints(addrs);
-
- SetRandomSeed(TInstant::Now().MicroSeconds());
-
- int minAttempts = 10;
- int attempts = 0;
-
- TString error;
-
- while (attempts < minAttempts) {
- for (const auto &addr : addrs) {
- // Randomized backoff
- if (attempts > 0)
- Sleep(TDuration::MilliSeconds(500 + RandomNumber<ui64>(1000)));
-
- NClient::TKikimr kikimr(GetKikimr(addr));
- auto configurator = kikimr.GetNodeConfigurator();
-
- Cout << "Trying to get configs from " << addr << Endl;
-
- auto result = configurator.SyncGetNodeConfig(RunConfig.NodeId,
- FQDNHostName(),
- TenantName,
- NodeType,
- DeduceNodeDomain(),
- AppConfig.GetAuthConfig().GetStaffApiUserToken(),
- true,
- 1);
-
- if (result.IsSuccess()) {
- auto appConfig = result.GetConfig();
-
- if (RunConfig.PathToConfigCacheFile) {
- Cout << "Saving config to cache file " << RunConfig.PathToConfigCacheFile << Endl;
- if (!SaveConfigForNodeToCache(appConfig)) {
- Cout << "Failed to save config to cache file" << Endl;
- }
- }
-
- NKikimrConfig::TAppConfig yamlConfig;
-
- if (result.HasYamlConfig() && !result.GetYamlConfig().empty()) {
- NYamlConfig::ResolveAndParseYamlConfig(
- result.GetYamlConfig(),
- result.GetVolatileYamlConfigs(),
- RunConfig.Labels,
- yamlConfig);
- }
-
- RunConfig.InitialCmsConfig.CopyFrom(appConfig);
-
- RunConfig.InitialCmsYamlConfig.CopyFrom(yamlConfig);
- NYamlConfig::ReplaceUnmanagedKinds(appConfig, RunConfig.InitialCmsYamlConfig);
-
- if (yamlConfig.HasYamlConfigEnabled() && yamlConfig.GetYamlConfigEnabled()) {
- BaseConfig.Swap(&yamlConfig);
- NYamlConfig::ReplaceUnmanagedKinds(result.GetConfig(), BaseConfig);
- } else {
- BaseConfig.Swap(&appConfig);
- }
-
- Cout << "Success." << Endl;
-
- return true;
- }
-
- error = result.GetErrorMessage();
- Cerr << "Configuration error: " << error << Endl;
- ++attempts;
- }
- }
-
- return false;
- }
-
- inline bool LoadConfigFromCache() {
- if (RunConfig.PathToConfigCacheFile) {
- NKikimrConfig::TAppConfig config;
- if (GetCachedConfig(config)) {
- BaseConfig.Swap(&config);
-
- return true;
- }
- }
-
- return false;
- }
-
inline void LoadYamlConfig(TCallContext callCtx) {
for(const TString& yamlConfigFile: YamlConfigFiles) {
auto yamlConfig = TFileInput(yamlConfigFile);
@@ -962,21 +864,6 @@ protected:
return res;
}
- void LoadBaseConfig(TConfig& config) {
- if (HierarchicalCfg) {
- if (LoadConfigFromCMS())
- return;
- if (LoadConfigFromCache())
- return;
- if (LoadBootstrapConfig(config))
- return;
-
- ythrow yexception() << "cannot load configuration";
- } else {
- LoadBootstrapConfig(config);
- }
- }
-
TString DeduceNodeDomain() {
if (NodeDomain)
return NodeDomain;
@@ -993,29 +880,6 @@ protected:
return "";
}
- bool GetCachedConfig(NKikimrConfig::TAppConfig &appConfig) {
- Y_DEBUG_ABORT_UNLESS(RunConfig.PathToConfigCacheFile, "GetCachedConfig called with a cms config cache file set");
-
- try {
- auto cacheFile = TFileInput(RunConfig.PathToConfigCacheFile);
- if (!google::protobuf::TextFormat::ParseFromString(cacheFile.ReadAll(), &appConfig))
- ythrow yexception() << "Failed to parse config protobuf from string";
- return true;
- } catch (const yexception &ex) {
- Cerr << "WARNING: an exception occurred while getting config from cache file: " << ex.what() << Endl;
- }
- return false;
- }
-
- void LoadCachedConfigsForStaticNode() {
- NKikimrConfig::TAppConfig appConfig;
-
- // log config
- if (GetCachedConfig(appConfig) && appConfig.HasLogConfig()) {
- AppConfig.MutableLogConfig()->CopyFrom(appConfig.GetLogConfig());
- }
- }
-
TNodeLocation CreateNodeLocation() {
NActorsInterconnect::TNodeLocation location;
location.SetDataCenter(DataCenter);
@@ -1344,30 +1208,6 @@ protected:
}
}
- bool SaveConfigForNodeToCache(const NKikimrConfig::TAppConfig &appConfig) {
- Y_DEBUG_ABORT_UNLESS(RunConfig.PathToConfigCacheFile, "SaveConfigForNodeToCache called without a cms config cache file set");
-
- // Ensure "atomicity" by writing to temp file and renaming it
- const TString pathToTempFile = RunConfig.PathToConfigCacheFile + ".tmp";
- TString proto;
- bool status;
- try {
- TFileOutput tempFile(pathToTempFile);
- status = google::protobuf::TextFormat::PrintToString(appConfig, &proto);
- if (status) {
- tempFile << proto;
- if (!NFs::Rename(pathToTempFile, RunConfig.PathToConfigCacheFile)) {
- ythrow yexception() << "Failed to rename temporary file " << LastSystemError() << " " << LastSystemErrorText();
- }
- }
- } catch (const yexception& ex) {
- Cerr << "WARNING: an exception occured while saving config to cache file: " << ex.what() << Endl;
- status = false;
- }
-
- return status;
- }
-
bool TryToLoadConfigForDynamicNodeFromCMS(const TString &addr, TString &error) {
NClient::TKikimr kikimr(GetKikimr(addr));
auto configurator = kikimr.GetNodeConfigurator();
@@ -1434,27 +1274,11 @@ protected:
}
}
- if (RunConfig.PathToConfigCacheFile) {
- Cout << "Saving config to cache file " << RunConfig.PathToConfigCacheFile << Endl;
- if (!SaveConfigForNodeToCache(appConfig)) {
- Cout << "Failed to save config to cache file" << Endl;
- }
- }
-
ApplyConfigForNode(appConfig);
return true;
}
- bool LoadConfigForDynamicNodeFromCache() {
- NKikimrConfig::TAppConfig config;
- if (GetCachedConfig(config)) {
- ApplyConfigForNode(config);
- return true;
- }
- return false;
- }
-
void LoadConfigForDynamicNode() {
auto res = false;
TString error;
@@ -1479,14 +1303,6 @@ protected:
if (!res) {
Cerr << "WARNING: couldn't load config from CMS: " << error << Endl;
- if (RunConfig.PathToConfigCacheFile) {
- Cout << "Loading config from cache file " << RunConfig.PathToConfigCacheFile << Endl;
- if (!LoadConfigForDynamicNodeFromCache())
- Cerr << "WARNING: couldn't load config from cache file" << Endl;
- } else {
- Cerr << "WARNING: option --cms-config-cache-file was not set, ";
- Cerr << "couldn't load config from cache file" << Endl;
- }
}
}
diff --git a/ydb/tests/functional/cms_config_cache/main.py b/ydb/tests/functional/cms_config_cache/main.py
deleted file mode 100644
index ec624b9a8c..0000000000
--- a/ydb/tests/functional/cms_config_cache/main.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import logging
-import os
-import time
-
-from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
-
-logger = logging.getLogger(__name__)
-
-
-class TestCmsConfigCacheMain(object):
-
- sample_log_config = """
-LogConfig {
- Entry {
- Component: "FLAT_TX_SCHEMESHARD"
- Level: 7
- }
- Entry {
- Component: "TENANT_SLOT_BROKER"
- Level: 7
- }
- Entry {
- Component: "TX_DATASHARD"
- Level: 5
- }
- Entry {
- Component: "LOCAL"
- Level: 7
- }
- Entry {
- Component: "TX_PROXY"
- Level: 5
- }
- Entry {
- Component: "HIVE"
- Level: 7
- }
- Entry {
- Component: "BS_CONTROLLER"
- Level: 7
- }
- SysLog: true
-}
-"""
-
- log_entry = """Entry {
- Component: "FLAT_TX_SCHEMESHARD"
- Level: 7
- }"""
-
- @classmethod
- def setup_class(cls):
- configurator = KikimrConfigGenerator()
- cls.cluster = kikimr_cluster_factory(configurator=configurator)
- cls.cluster.start()
- cls.cluster.create_database(
- '/Root/database',
- storage_pool_units_count={'hdd': 1}
- )
- cls.cluster.register_and_start_slots('/Root/database', count=1)
- cls.cluster.wait_tenant_up('/Root/database')
-
- @classmethod
- def teardown_class(cls):
- cls.cluster.stop()
-
- def _cms_config_cache_file_path(self):
- slot = self.cluster.slots[1]
- path = os.path.join(slot.cwd, slot.cms_config_cache_file_name)
- return path
-
- def test_cache_log_settings(self):
- with open(self._cms_config_cache_file_path(), 'r') as file:
- assert self.log_entry not in file.read(), "initial node config should not contain LogConfig items"
- self.cluster.client.add_config_item(self.sample_log_config)
- timeout = 60
- step = 1
- cur = 0
- config_updated = False
- while not config_updated and cur < timeout:
- time.sleep(step)
- cur += step
- with open(self._cms_config_cache_file_path(), 'r') as file:
- config_updated = self.log_entry in file.read()
- assert config_updated, "log config wasn't updated"
-
- def test_cms_config_cache(self):
- with open(self._cms_config_cache_file_path(), 'r') as file:
- cfg = file.read()
- assert len(cfg) > 0
diff --git a/ydb/tests/functional/cms_config_cache/ya.make b/ydb/tests/functional/cms_config_cache/ya.make
deleted file mode 100644
index 39fcf2d69f..0000000000
--- a/ydb/tests/functional/cms_config_cache/ya.make
+++ /dev/null
@@ -1,24 +0,0 @@
-PY3TEST()
-ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-TEST_SRCS(
- main.py
-)
-
-TIMEOUT(600)
-
-SIZE(MEDIUM)
-
-DEPENDS(
- ydb/apps/ydbd
-)
-
-PEERDIR(
- ydb/tests/library
- ydb/public/sdk/python
-)
-
-FORK_SUBTESTS()
-
-FORK_TEST_FILES()
-
-END()
diff --git a/ydb/tests/functional/ya.make b/ydb/tests/functional/ya.make
index 4365117649..7a031afa48 100644
--- a/ydb/tests/functional/ya.make
+++ b/ydb/tests/functional/ya.make
@@ -6,7 +6,6 @@ RECURSE(
canonical
clickbench
cms
- cms_config_cache
dynumber
encryption
hive
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index 0d0a1fd777..bbc10df0b0 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -80,12 +80,6 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
else:
self.__log_file = None
- self.__cms_config_cache_file = tempfile.NamedTemporaryFile(
- dir=self.cwd,
- prefix="cms_config_cache_",
- delete=False
- )
- self.__cms_config_cache_file_name = self.__cms_config_cache_file.name
daemon.Daemon.__init__(self, self.command, cwd=self.cwd, timeout=180, stderr_on_error_lines=240)
self.__binary_path = None
@@ -112,10 +106,6 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
return self.__configurator.binary_path
@property
- def cms_config_cache_file_name(self):
- return self.__cms_config_cache_file_name
-
- @property
def command(self):
return self.__make_run_command()
@@ -182,7 +172,6 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
"--grpc-port=%s" % self.grpc_port,
"--mon-port=%d" % self.mon_port,
"--ic-port=%d" % self.ic_port,
- "--cms-config-cache-file=%s" % self.cms_config_cache_file_name,
]
)