Skip to content

Commit

Permalink
more EnableColumnStatistics feature flag logic (#5733)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexd65536 authored Jun 20, 2024
1 parent c286e4b commit 4290761
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ydb/core/statistics/aggregator/aggregator_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NConsole::TEvConsole::TEvConfigNotificationResponse>(record);
Send(ev->Sender, response.release(), 0, ev->Cookie);
Expand Down Expand Up @@ -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<TEvStatistics::TEvStatTableCreationResponse>()));
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/statistics/aggregator/aggregator_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TStatisticsAggregator : public TActor<TStatisticsAggregator>, public NTabl
void Handle(TEvPrivate::TEvScheduleScan::TPtr& ev);
void Handle(TEvStatistics::TEvGetScanStatus::TPtr& ev);

void Initialize();
void InitializeStatisticsTable();
void Navigate();
void Resolve();
void NextRange();
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/statistics/aggregator/tx_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4290761

Please sign in to comment.