From 7f9d9b8fdf0d83c351c1214e3409c16862f73acd Mon Sep 17 00:00:00 2001 From: ivanmorozov333 Date: Sat, 11 Jan 2025 09:20:26 +0300 Subject: [PATCH] fix portions cleanup --- .../columnshard/engines/changes/cleanup_portions.cpp | 10 ++++++---- .../tx/columnshard/engines/changes/cleanup_portions.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ydb/core/tx/columnshard/engines/changes/cleanup_portions.cpp b/ydb/core/tx/columnshard/engines/changes/cleanup_portions.cpp index aa6152a9fd93..bea98d0c7ddd 100644 --- a/ydb/core/tx/columnshard/engines/changes/cleanup_portions.cpp +++ b/ydb/core/tx/columnshard/engines/changes/cleanup_portions.cpp @@ -29,10 +29,12 @@ void TCleanupPortionsColumnEngineChanges::DoWriteIndexOnExecute(NColumnShard::TC auto schemaPtr = context.EngineLogs.GetVersionedIndex().GetLastSchema(); THashMap> blobIdsByStorage; - for (auto&& [_, p] : FetchedDataAccessors->GetPortions()) { - p.RemoveFromDatabase(context.DBWrapper); - p.FillBlobIdsByStorage(blobIdsByStorage, context.EngineLogs.GetVersionedIndex()); - pathIds.emplace(p.GetPortionInfo().GetPathId()); + + for (auto&& p : PortionsToDrop) { + const auto& accessor = FetchedDataAccessors->GetPortionAccessorVerified(p->GetPortionId()); + accessor.RemoveFromDatabase(context.DBWrapper); + accessor.FillBlobIdsByStorage(blobIdsByStorage, context.EngineLogs.GetVersionedIndex()); + pathIds.emplace(p->GetPathId()); } for (auto&& i : blobIdsByStorage) { auto action = BlobsAction.GetRemoving(i.first); diff --git a/ydb/core/tx/columnshard/engines/changes/cleanup_portions.h b/ydb/core/tx/columnshard/engines/changes/cleanup_portions.h index 0ef8c6bea6a8..d1d92d03e9e3 100644 --- a/ydb/core/tx/columnshard/engines/changes/cleanup_portions.h +++ b/ydb/core/tx/columnshard/engines/changes/cleanup_portions.h @@ -68,6 +68,7 @@ class TCleanupPortionsColumnEngineChanges: public TColumnEngineChanges, void AddPortionToRemove(const TPortionInfo::TConstPtr& portion) { PortionsToRemove.AddPortion(portion); + PortionsToAccess->AddPortion(portion); } virtual ui32 GetWritePortionsCount() const override {