diff options
author | Alek5andr-Kotov <akotov@ydb.tech> | 2024-08-02 09:49:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 09:49:28 +0300 |
commit | 641640653cf02de3c1c24e7e642bcce0e1639b5c (patch) | |
tree | a62554771c9ada302c85ecc7515387ce4c1dc3f4 | |
parent | e2779636594b561b1c881dec60dd7cc4f56ad910 (diff) | |
download | ydb-641640653cf02de3c1c24e7e642bcce0e1639b5c.tar.gz |
Memory leaks (#7375)
-rw-r--r-- | ydb/core/persqueue/partition.cpp | 2 | ||||
-rw-r--r-- | ydb/core/persqueue/pq_impl.cpp | 15 | ||||
-rw-r--r-- | ydb/core/persqueue/pq_impl.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/ydb/core/persqueue/partition.cpp b/ydb/core/persqueue/partition.cpp index 227b255e222..45286e64835 100644 --- a/ydb/core/persqueue/partition.cpp +++ b/ydb/core/persqueue/partition.cpp @@ -507,8 +507,8 @@ void TPartition::DestroyActor(const TActorContext& ctx) UsersInfoStorage->Clear(ctx); } + Send(ReadQuotaTrackerActor, new TEvents::TEvPoisonPill()); if (!IsSupportive()) { - Send(ReadQuotaTrackerActor, new TEvents::TEvPoisonPill()); Send(WriteQuotaTrackerActor, new TEvents::TEvPoisonPill()); } diff --git a/ydb/core/persqueue/pq_impl.cpp b/ydb/core/persqueue/pq_impl.cpp index f86b619bbaf..2e31272e4ed 100644 --- a/ydb/core/persqueue/pq_impl.cpp +++ b/ydb/core/persqueue/pq_impl.cpp @@ -4636,6 +4636,19 @@ void TPersQueue::Handle(TEvPQ::TEvPartitionScaleStatusChanged::TPtr& ev, const T } } +void TPersQueue::DeletePartition(const TPartitionId& partitionId, const TActorContext& ctx) +{ + auto p = Partitions.find(partitionId); + if (p == Partitions.end()) { + return; + } + + const TPartitionInfo& partition = p->second; + ctx.Send(partition.Actor, new TEvents::TEvPoisonPill()); + + Partitions.erase(partitionId); +} + void TPersQueue::Handle(TEvPQ::TEvDeletePartitionDone::TPtr& ev, const TActorContext& ctx) { PQ_LOG_D("Handle TEvPQ::TEvDeletePartitionDone " << ev->Get()->PartitionId); @@ -4651,7 +4664,7 @@ void TPersQueue::Handle(TEvPQ::TEvDeletePartitionDone::TPtr& ev, const TActorCon Y_ABORT_UNLESS(partitionId.IsSupportivePartition()); Y_ABORT_UNLESS(Partitions.contains(partitionId)); - Partitions.erase(partitionId); + DeletePartition(partitionId, ctx); writeInfo.Partitions.erase(partitionId.OriginalPartitionId); if (writeInfo.Partitions.empty()) { diff --git a/ydb/core/persqueue/pq_impl.h b/ydb/core/persqueue/pq_impl.h index f01a0a3f786..73a0ab5d744 100644 --- a/ydb/core/persqueue/pq_impl.h +++ b/ydb/core/persqueue/pq_impl.h @@ -505,6 +505,7 @@ private: bool CheckTxWriteOperations(const NKikimrPQ::TDataTransaction& txBody) const; void MoveTopTxToCalculating(TDistributedTransaction& tx, const TActorContext& ctx); + void DeletePartition(const TPartitionId& partitionId, const TActorContext& ctx); }; |