@@ -89,6 +89,7 @@ TColumnShard::TColumnShard(TTabletStorageInfo* info, const TActorId& tablet)
89
89
, SubscribeCounters(std::make_shared<NOlap::NResourceBroker::NSubscribe::TSubscriberCounters>())
90
90
, InsertTaskSubscription(NOlap::TInsertColumnEngineChanges::StaticTypeName(), SubscribeCounters)
91
91
, CompactTaskSubscription(NOlap::TCompactColumnEngineChanges::StaticTypeName(), SubscribeCounters)
92
+ , TTLTaskSubscription(NOlap::TTTLColumnEngineChanges::StaticTypeName(), SubscribeCounters)
92
93
, ReadCounters(" Read" )
93
94
, ScanCounters(" Scan" )
94
95
, WritesMonitor(*this )
@@ -744,21 +745,25 @@ bool TColumnShard::SetupTtl(const THashMap<ui64, NOlap::TTiering>& pathTtls, con
744
745
}
745
746
746
747
auto actualIndexInfo = TablesManager.GetPrimaryIndex ()->GetVersionedIndex ();
747
- std::shared_ptr<NOlap::TTTLColumnEngineChanges> indexChanges = TablesManager.MutablePrimaryIndex ().StartTtl (eviction, BackgroundController.GetConflictTTLPortions ());
748
+ const ui64 memoryUsageLimit = HasAppData () ? AppDataVerified ().ColumnShardConfig .GetTieringsMemoryLimit () : ((ui64)512 * 1024 * 1024 );
749
+ std::shared_ptr<NOlap::TTTLColumnEngineChanges> indexChanges = TablesManager.MutablePrimaryIndex ().StartTtl (
750
+ eviction, BackgroundController.GetConflictTTLPortions (), memoryUsageLimit);
748
751
749
752
if (!indexChanges) {
750
753
ACFL_DEBUG (" background" , " ttl" )(" skip_reason" , " no_changes" );
751
754
return false ;
752
755
}
753
-
756
+ const TString externalTaskId = indexChanges-> GetTaskIdentifier ();
754
757
const bool needWrites = indexChanges->NeedConstruction ();
755
758
ACFL_DEBUG (" background" , " ttl" )(" need_writes" , needWrites);
756
759
757
760
indexChanges->Start (*this );
758
761
auto ev = std::make_unique<TEvPrivate::TEvWriteIndex>(std::move (actualIndexInfo), indexChanges, false );
759
762
NYDBTest::TControllers::GetColumnShardController ()->OnWriteIndexStart (TabletID (), indexChanges->TypeString ());
760
763
if (needWrites) {
761
- ActorContext ().Register (new NOlap::NBlobOperations::NRead::TActor (std::make_shared<TChangesReadTask>(std::move (ev), SelfId (), TabletID (), CompactionCounters)));
764
+ NOlap::NResourceBroker::NSubscribe::ITask::StartResourceSubscription (
765
+ ResourceSubscribeActor, std::make_shared<NOlap::NBlobOperations::NRead::ITask::TReadSubscriber>(
766
+ std::make_shared<TChangesReadTask>(std::move(ev), SelfId(), TabletID(), CompactionCounters), 0, indexChanges->CalcMemoryForUsage(), externalTaskId, TTLTaskSubscription));
762
767
} else {
763
768
ev->SetPutStatus (NKikimrProto::OK);
764
769
ActorContext ().Send (SelfId (), std::move (ev));
0 commit comments