From 4290761bd837df7ee0b31378fe0fe2a084c375bb Mon Sep 17 00:00:00 2001 From: Aleksandr Dmitriev Date: Thu, 20 Jun 2024 12:03:55 +0300 Subject: [PATCH] more EnableColumnStatistics feature flag logic (#5733) --- ydb/core/statistics/aggregator/aggregator_impl.cpp | 10 +++++++++- ydb/core/statistics/aggregator/aggregator_impl.h | 2 +- ydb/core/statistics/aggregator/tx_init.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ydb/core/statistics/aggregator/aggregator_impl.cpp b/ydb/core/statistics/aggregator/aggregator_impl.cpp index 01136961b905..e6b4fbe97f1f 100644 --- a/ydb/core/statistics/aggregator/aggregator_impl.cpp +++ b/ydb/core/statistics/aggregator/aggregator_impl.cpp @@ -56,7 +56,12 @@ void TStatisticsAggregator::HandleConfig(NConsole::TEvConsole::TEvConfigNotifica if (config.HasFeatureFlags()) { const auto& featureFlags = config.GetFeatureFlags(); EnableStatistics = featureFlags.GetEnableStatistics(); + + bool enableColumnStatisticsOld = EnableColumnStatistics; EnableColumnStatistics = featureFlags.GetEnableColumnStatistics(); + if (!enableColumnStatisticsOld && EnableColumnStatistics) { + InitializeStatisticsTable(); + } } auto response = std::make_unique(record); Send(ev->Sender, response.release(), 0, ev->Cookie); @@ -434,7 +439,10 @@ void TStatisticsAggregator::Handle(TEvStatistics::TEvGetScanStatus::TPtr& ev) { Send(ev->Sender, response.release(), 0, ev->Cookie); } -void TStatisticsAggregator::Initialize() { +void TStatisticsAggregator::InitializeStatisticsTable() { + if (!EnableColumnStatistics) { + return; + } Register(CreateStatisticsTableCreator(std::make_unique())); } diff --git a/ydb/core/statistics/aggregator/aggregator_impl.h b/ydb/core/statistics/aggregator/aggregator_impl.h index 6aab7afab980..b4e560515659 100644 --- a/ydb/core/statistics/aggregator/aggregator_impl.h +++ b/ydb/core/statistics/aggregator/aggregator_impl.h @@ -115,7 +115,7 @@ class TStatisticsAggregator : public TActor, public NTabl void Handle(TEvPrivate::TEvScheduleScan::TPtr& ev); void Handle(TEvStatistics::TEvGetScanStatus::TPtr& ev); - void Initialize(); + void InitializeStatisticsTable(); void Navigate(); void Resolve(); void NextRange(); diff --git a/ydb/core/statistics/aggregator/tx_init.cpp b/ydb/core/statistics/aggregator/tx_init.cpp index ab9d9ce34cd7..4dbd2295c015 100644 --- a/ydb/core/statistics/aggregator/tx_init.cpp +++ b/ydb/core/statistics/aggregator/tx_init.cpp @@ -219,7 +219,7 @@ struct TStatisticsAggregator::TTxInit : public TTxBase { Self->Schedule(Self->PropagateInterval, new TEvPrivate::TEvPropagate()); Self->Schedule(Self->ScheduleScanIntervalTime, new TEvPrivate::TEvScheduleScan()); - Self->Initialize(); + Self->InitializeStatisticsTable(); if (Self->ScanTableId.PathId) { Self->Navigate();