From 7487d615a7fc38f3aeb643c7379c3c76ad81acaf Mon Sep 17 00:00:00 2001 From: Aleksandr Dmitriev Date: Fri, 14 Jun 2024 11:52:43 +0300 Subject: [PATCH] merge to stable-24-1: use proper compaction policy for SA tables (#5517) --- ydb/core/statistics/aggregator/tx_init_schema.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ydb/core/statistics/aggregator/tx_init_schema.cpp b/ydb/core/statistics/aggregator/tx_init_schema.cpp index 2ba697933006..4c77a9b5e9cb 100644 --- a/ydb/core/statistics/aggregator/tx_init_schema.cpp +++ b/ydb/core/statistics/aggregator/tx_init_schema.cpp @@ -14,6 +14,17 @@ struct TStatisticsAggregator::TTxInitSchema : public TTxBase { NIceDb::TNiceDb(txc.DB).Materialize(); + static constexpr NIceDb::TTableId bigTableIds[] = { + Schema::BaseStats::TableId, + }; + + for (auto id : bigTableIds) { + const auto* tableInfo = txc.DB.GetScheme().GetTableInfo(id); + if (!tableInfo || !tableInfo->CompactionPolicy) { + txc.DB.Alter().SetCompactionPolicy(id, *NLocalDb::CreateDefaultUserTablePolicy()); + } + } + return true; }