diff options
author | innokentii <innokentii@yandex-team.com> | 2023-08-01 15:18:31 +0300 |
---|---|---|
committer | innokentii <innokentii@yandex-team.com> | 2023-08-01 15:18:31 +0300 |
commit | e2c8914a270962f2bc076aa5bc0dd9e6825badfd (patch) | |
tree | 0786a121900e24a69e49184802be8e525ed233b0 | |
parent | c202aa1d935b27968c83addf1436c651bffc78bd (diff) | |
download | ydb-e2c8914a270962f2bc076aa5bc0dd9e6825badfd.tar.gz |
Fix console restart logic
fix console restart logic
-rw-r--r-- | ydb/core/cms/console/console_configs_manager.cpp | 10 | ||||
-rw-r--r-- | ydb/core/cms/console/console_ut_configs.cpp | 38 |
2 files changed, 41 insertions, 7 deletions
diff --git a/ydb/core/cms/console/console_configs_manager.cpp b/ydb/core/cms/console/console_configs_manager.cpp index 110b26505b0..26c1058d807 100644 --- a/ydb/core/cms/console/console_configs_manager.cpp +++ b/ydb/core/cms/console/console_configs_manager.cpp @@ -76,13 +76,6 @@ void TConfigsManager::Bootstrap(const TActorContext &ctx) false, NKikimrServices::CMS_CONFIGS); ConfigsProvider = ctx.Register(new TConfigsProvider(ctx.SelfID)); - - if (!YamlConfig.empty()) { - auto resp = MakeHolder<TConfigsProvider::TEvPrivate::TEvUpdateYamlConfig>( - YamlConfig, - VolatileYamlConfigs); - ctx.Send(ConfigsProvider, resp.Release()); - } } void TConfigsManager::Detach() @@ -918,6 +911,9 @@ void TConfigsManager::Handle(TEvPrivate::TEvStateLoaded::TPtr &/*ev*/, const TAc ctx.Send(ConfigsProvider, new TConfigsProvider::TEvPrivate::TEvSetConfigs(ConfigIndex.GetConfigItems())); ctx.Send(ConfigsProvider, new TConfigsProvider::TEvPrivate::TEvSetSubscriptions(SubscriptionIndex.GetSubscriptions())); ctx.Send(GetNameserviceActorId(), new TEvInterconnect::TEvListNodes()); + if (!YamlConfig.empty()) { + ctx.Send(ConfigsProvider, new TConfigsProvider::TEvPrivate::TEvUpdateYamlConfig(YamlConfig, VolatileYamlConfigs)); + } ScheduleLogCleanup(ctx); } diff --git a/ydb/core/cms/console/console_ut_configs.cpp b/ydb/core/cms/console/console_ut_configs.cpp index de27e7ee9e9..3f1c1f9bcdc 100644 --- a/ydb/core/cms/console/console_ut_configs.cpp +++ b/ydb/core/cms/console/console_ut_configs.cpp @@ -3922,6 +3922,44 @@ Y_UNIT_TEST_SUITE(TConsoleInMemoryConfigSubscriptionTests) { UNIT_ASSERT_VALUES_EQUAL(notification->Get()->Record.HasYamlConfig(), false); } + Y_UNIT_TEST(TestConsoleRestart) { + TTenantTestRuntime runtime(MultipleNodesConsoleTestConfig()); + InitializeTestConfigItems(); + + TActorId edgeId = runtime.AllocateEdgeActor(1); + + ITEM_DOMAIN_LOG_1.MutableConfig()->MutableLogConfig()->SetClusterName("cluster-1"); + + CheckConfigure(runtime, Ydb::StatusIds::SUCCESS, + MakeAddAction(ITEM_DOMAIN_LOG_1)); + + CheckReplaceConfig(runtime, Ydb::StatusIds::SUCCESS, YAML_CONFIG_1); + + GracefulRestartTablet(runtime, MakeConsoleID(0), runtime.AllocateEdgeActor(0)); + + auto subscriber = NConsole::CreateConfigsSubscriber( + edgeId, + TVector<ui32>({(ui32)NKikimrConsole::TConfigItem::LogConfigItem}), + NKikimrConfig::TAppConfig(), + 0, + true, + 1); + runtime.Register(subscriber, 1); + + NKikimrConfig::TAppConfig config; + config.MutableLogConfig()->SetClusterName("cluster-1"); + + auto item = config.MutableVersion()->AddItems(); + item->SetKind(NKikimrConsole::TConfigItem::LogConfigItem); + item->SetId(1); + item->SetGeneration(1); + + auto notification = runtime.GrabEdgeEventRethrow<TEvConsole::TEvConfigSubscriptionNotification>(edgeId); + UNIT_ASSERT_VALUES_EQUAL(notification->Get()->Record.GetGeneration(), 1); + UNIT_ASSERT_VALUES_EQUAL(notification->Get()->Record.GetConfig().ShortDebugString(), config.ShortDebugString()); + UNIT_ASSERT_VALUES_EQUAL(notification->Get()->Record.GetYamlConfig(), YAML_CONFIG_1_UPDATED); + } + Y_UNIT_TEST(TestComplexYamlConfigChanges) { TTenantTestRuntime runtime(MultipleNodesConsoleTestConfig()); InitializeTestConfigItems(); |