diff options
author | hor911 <hor911@yandex-team.ru> | 2022-02-21 15:13:45 +0300 |
---|---|---|
committer | hor911 <hor911@yandex-team.ru> | 2022-02-21 15:13:45 +0300 |
commit | c161c2c45e7a70edd43d8fb8b4de942d62db5690 (patch) | |
tree | 97d050dc967f4b52cf0b836c057a3b196d03c068 | |
parent | e22a68f9594b42c23ef670fc428a70f88fc16244 (diff) | |
download | ydb-c161c2c45e7a70edd43d8fb8b4de942d62db5690.tar.gz |
YQ node kind
ref:2530808a56368a541313f3776dc7a551dd45d7f9
-rw-r--r-- | ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp | 17 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/config.h | 14 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/run.cpp | 5 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_config.py | 2 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_runner.py | 29 |
5 files changed, 55 insertions, 12 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 a1bab13812..c4d144cb5a 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp @@ -19,6 +19,9 @@ extern TAutoPtr<NKikimrConfig::TAllocatorConfig> DummyAllocatorConfig(); namespace NKikimr { namespace NDriverClient { +constexpr auto NODE_KIND_YDB = "ydb"; +constexpr auto NODE_KIND_YQ = "yq"; + class TClientCommandServerBase : public TClientCommand { protected: NKikimrConfig::TAppConfig BaseConfig; @@ -68,6 +71,7 @@ protected: TString NodeDomain; ui32 InterconnectPort; ui32 SqsHttpPort; + TString NodeKind = NODE_KIND_YDB; TString NodeType; TString DataCenter; TString Rack; @@ -230,6 +234,8 @@ protected: config.Opts->AddLongOption("compile-inflight-limit", "Limit on parallel programs compilation").OptionalArgument("NUM").StoreResult(&CompileInflightLimit); config.Opts->AddLongOption("udf", "Load shared library with UDF by given path").AppendTo(&UDFsPaths); config.Opts->AddLongOption("udfs-dir", "Load all shared libraries with UDFs found in given directory").StoreResult(&UDFsDir); + config.Opts->AddLongOption("node-kind", Sprintf("Kind of the node (affects list of services activated allowed values are {'%s', '%s'} )", NODE_KIND_YDB, NODE_KIND_YQ)) + .RequiredArgument("NAME").StoreResult(&NodeKind); config.Opts->AddLongOption("node-type", "Type of the node") .RequiredArgument("NAME").StoreResult(&NodeType); config.Opts->AddLongOption("ignore-cms-configs", "Don't load configs from CMS") @@ -361,7 +367,7 @@ protected: if (!IsStartWithSlash(TenantName) && TenantName != "no" && TenantName != "dynamic") { ythrow yexception() << "lead / in --tenant parametr is always required except from 'no' and 'dynamic'"; } - if (TenantName != "no" && NodeId) { + if (TenantName != "no" && NodeId && NodeKind != NODE_KIND_YQ) { ythrow yexception() << "opt '--node' compatible only with '--tenant no', opt 'node' incompatible with any other values of opt '--tenant'"; } if (config.ParseResult->Has("tenant-pool-file")) { @@ -369,6 +375,15 @@ protected: } } + if (NodeKind == NODE_KIND_YDB) { + // do nothing => default behaviour + } else if (NodeKind == NODE_KIND_YQ) { + RunConfig.ServicesMask.DisableAll(); + RunConfig.ServicesMask.EnableYQ(); + } else { + ythrow yexception() << "wrong '--node-kind' value '" << NodeKind << "', only '" << NODE_KIND_YDB << "' or '" << NODE_KIND_YQ << "' is allowed"; + } + MaybeRegisterAndLoadConfigs(); LoadYamlConfig(); diff --git a/ydb/core/driver_lib/run/config.h b/ydb/core/driver_lib/run/config.h index faf1797413..88537ec94e 100644 --- a/ydb/core/driver_lib/run/config.h +++ b/ydb/core/driver_lib/run/config.h @@ -76,6 +76,18 @@ union TBasicKikimrServicesMask { Raw = 0xFFFFFFFFFFFFFFFFLL; } + void EnableYQ() { + EnableBasicServices = true; + EnableLogger = true; + EnableSchedulerActor = true; + EnableStatsCollector = true; + EnableSelfPing = true; + EnableMemoryLog = true; + EnableGRpcService = true; + EnableSecurityServices = true; + EnableYandexQuery = true; + } + TBasicKikimrServicesMask() { EnableAll(); } @@ -91,6 +103,8 @@ struct TKikimrRunConfig { TString PathToConfigCacheFile; + TBasicKikimrServicesMask ServicesMask; + TKikimrRunConfig(NKikimrConfig::TAppConfig& appConfig, ui32 nodeId = 0, const TKikimrScopeId& scopeId = {}); }; diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp index a4f74aa4e0..1d735aa67d 100644 --- a/ydb/core/driver_lib/run/run.cpp +++ b/ydb/core/driver_lib/run/run.cpp @@ -1557,7 +1557,6 @@ void TKikimrRunner::InitializeRegistries(const TKikimrRunConfig& runConfig) { TIntrusivePtr<TKikimrRunner> TKikimrRunner::CreateKikimrRunner( const TKikimrRunConfig& runConfig, std::shared_ptr<TModuleFactories> factories) { - TBasicKikimrServicesMask servicesMask; // all services enabled by default TIntrusivePtr<TKikimrRunner> runner(new TKikimrRunner(factories)); runner->InitializeAllocator(runConfig); @@ -1567,8 +1566,8 @@ TIntrusivePtr<TKikimrRunner> TKikimrRunner::CreateKikimrRunner( runner->InitializeMessageBus(runConfig, factories); runner->InitializeAppData(runConfig); runner->InitializeLogSettings(runConfig); - TIntrusivePtr<TServiceInitializersList> sil(runner->CreateServiceInitializersList(runConfig, servicesMask)); - runner->InitializeActorSystem(runConfig, sil, servicesMask); + TIntrusivePtr<TServiceInitializersList> sil(runner->CreateServiceInitializersList(runConfig, runConfig.ServicesMask)); + runner->InitializeActorSystem(runConfig, sil, runConfig.ServicesMask); runner->InitializeMonitoringLogin(runConfig); runner->InitializeKqpController(runConfig); runner->InitializeGracefulShutdown(runConfig); diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py index d27e959091..7b4e7b77ec 100644 --- a/ydb/tests/library/harness/kikimr_config.py +++ b/ydb/tests/library/harness/kikimr_config.py @@ -113,6 +113,7 @@ class KikimrConfigGenerator(object): auth_config_path=None, disable_mvcc=False, enable_public_api_external_blobs=False, + node_kind=None ): self._version = version self.use_log_files = use_log_files @@ -175,6 +176,7 @@ class KikimrConfigGenerator(object): self.__dynamic_pdisks = dynamic_pdisks self.__output_path = output_path or yatest_common.output_path() + self.node_kind = node_kind self.yaml_config = load_default_yaml(self.__node_ids, self.domain_name, self.static_erasure, self.n_to_select, self.__node_ids, self.__additional_log_configs) self.yaml_config["feature_flags"]["enable_public_api_external_blobs"] = enable_public_api_external_blobs diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py index 251f485b5d..b253dd743e 100644 --- a/ydb/tests/library/harness/kikimr_runner.py +++ b/ydb/tests/library/harness/kikimr_runner.py @@ -144,6 +144,11 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface): ) ) + if self.__configurator.node_kind is not None: + command.append( + "--node-kind=%s" % self.__configurator.node_kind + ) + command.extend( [ "--yaml-config=%s" % join(self.__config_path, "config.yaml"), @@ -289,8 +294,11 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): for node_id in self.__configurator.all_node_ids(): self.__run_node(node_id) - self.__wait_for_bs_controller_to_start() - self.__add_bs_box() + bs_needed = 'blob_storage_config' in self.__configurator.yaml_config + + if bs_needed: + self.__wait_for_bs_controller_to_start() + self.__add_bs_box() pools = {} @@ -302,16 +310,21 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): ) pools[p['name']] = p['kind'] - self.client.bind_storage_pools(self.domain_name, pools) - default_pool_name = list(pools.keys())[0] + if len(pools) > 0: + self.client.bind_storage_pools(self.domain_name, pools) + default_pool_name = list(pools.keys())[0] + else: + default_pool_name = "" + self.default_channel_bindings = {idx: default_pool_name for idx in range(3)} logger.info("Cluster started and initialized") - self.client.add_config_item( - resource.find( - "harness/resources/default_profile.txt" + if bs_needed: + self.client.add_config_item( + resource.find( + "harness/resources/default_profile.txt" + ) ) - ) def __run_node(self, node_id): """ |