11#pragma once
22#include " engines/changes/abstract/compaction_info.h"
33#include " engines/portions/meta.h"
4+ #include < ydb/core/tx/columnshard/counters/statistics_store.h>
45#include < ydb/core/base/appdata.h>
56
67namespace NKikimr ::NOlap {
@@ -15,13 +16,16 @@ class TBackgroundController {
1516
1617 using TCurrentCompaction = THashMap<ui64, NOlap::TPlanCompactionInfo>;
1718 TCurrentCompaction ActiveCompactionInfo;
18- THashMap<ui64, TInstant> LastCompactionFinishByPathId;
1919
20+ TBackgroundControllerCounters& Stats;
2021 bool ActiveCleanupPortions = false ;
2122 bool ActiveCleanupTables = false ;
2223 bool ActiveCleanupInsertTable = false ;
2324 YDB_READONLY (TMonotonic, LastIndexationInstant, TMonotonic::Zero());
2425public:
26+ TBackgroundController (TBackgroundControllerCounters& stats) : Stats(stats) {
27+ }
28+
2529 THashSet<NOlap::TPortionAddress> GetConflictTTLPortions () const ;
2630 THashSet<NOlap::TPortionAddress> GetConflictCompactionPortions () const ;
2731
@@ -31,8 +35,7 @@ class TBackgroundController {
3135 bool StartCompaction (const NOlap::TPlanCompactionInfo& info);
3236 void FinishCompaction (const NOlap::TPlanCompactionInfo& info) {
3337 Y_ABORT_UNLESS (ActiveCompactionInfo.erase (info.GetPathId ()));
34- TInstant& lastFinishInstant = LastCompactionFinishByPathId[info.GetPathId ()];
35- lastFinishInstant = std::max (lastFinishInstant, TAppData::TimeProvider->Now ());
38+ Stats.OnCompactionFinish (info.GetPathId ());
3639 }
3740 const TCurrentCompaction& GetActiveCompaction () const {
3841 return ActiveCompactionInfo;
0 commit comments