Skip to content

Commit a37a4ae

Browse files
fix portions cleaning in case table removed (#9325)
1 parent c42930c commit a37a4ae

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

ydb/core/tx/columnshard/engines/column_engine_logs.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,16 @@ std::shared_ptr<TCleanupPortionsColumnEngineChanges> TColumnEngineForLogs::Start
343343
ui32 skipLocked = 0;
344344
ui32 portionsFromDrop = 0;
345345
bool limitExceeded = false;
346-
THashSet<TPortionAddress> uniquePortions;
347346
for (ui64 pathId : pathsToDrop) {
348347
auto g = GranulesStorage->GetGranuleOptional(pathId);
349348
if (!g) {
350349
continue;
351350
}
352351

353352
for (auto& [portion, info] : g->GetPortions()) {
353+
if (info->CheckForCleanup()) {
354+
continue;
355+
}
354356
if (dataLocksManager->IsLocked(*info)) {
355357
++skipLocked;
356358
continue;
@@ -361,7 +363,6 @@ std::shared_ptr<TCleanupPortionsColumnEngineChanges> TColumnEngineForLogs::Start
361363
limitExceeded = true;
362364
break;
363365
}
364-
AFL_VERIFY(uniquePortions.emplace(info->GetAddress()).second);
365366
changes->PortionsToDrop.push_back(*info);
366367
++portionsFromDrop;
367368
}
@@ -380,16 +381,14 @@ std::shared_ptr<TCleanupPortionsColumnEngineChanges> TColumnEngineForLogs::Start
380381
++i;
381382
continue;
382383
}
383-
if (uniquePortions.emplace(it->second[i].GetAddress()).second) {
384-
AFL_VERIFY(it->second[i].CheckForCleanup(snapshot))("p_snapshot", it->second[i].GetRemoveSnapshotOptional())("snapshot", snapshot);
385-
if (txSize + it->second[i].GetTxVolume() < txSizeLimit || changes->PortionsToDrop.empty()) {
386-
txSize += it->second[i].GetTxVolume();
387-
} else {
388-
limitExceeded = true;
389-
break;
390-
}
391-
changes->PortionsToDrop.push_back(std::move(it->second[i]));
384+
AFL_VERIFY(it->second[i].CheckForCleanup(snapshot))("p_snapshot", it->second[i].GetRemoveSnapshotOptional())("snapshot", snapshot);
385+
if (txSize + it->second[i].GetTxVolume() < txSizeLimit || changes->PortionsToDrop.empty()) {
386+
txSize += it->second[i].GetTxVolume();
387+
} else {
388+
limitExceeded = true;
389+
break;
392390
}
391+
changes->PortionsToDrop.push_back(std::move(it->second[i]));
393392
if (i + 1 < it->second.size()) {
394393
it->second[i] = std::move(it->second.back());
395394
}

0 commit comments

Comments
 (0)