Skip to content

Commit b3b79e7

Browse files
authored
Fix VDisk compaction bug (#16151)
1 parent 6ea5cd0 commit b3b79e7

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,6 @@ namespace NKikimr {
7878
// create a new slice
7979
TLevelSlicePtr res(new TLevelSlice(settings, slice->Ctx));
8080

81-
// assign VolatileOrderId for any new SSTables at level 0 to allow merging them to level 0 below
82-
{
83-
for (auto it = addIt; it.Valid(); it.Next()) {
84-
if (const auto& table = it.Get(); !table.Level) {
85-
const ui64 prev = std::exchange(table.SstPtr->VolatileOrderId, ++slice->Ctx->VolatileOrderId);
86-
Y_ABORT_UNLESS(prev == 0);
87-
} else { // items are sorted in ascending order of Level
88-
break;
89-
}
90-
}
91-
}
92-
9381
ui32 levelsSize = slice->SortedLevels.size();
9482
if (ctask.Action == NHullComp::ActCompactSsts) {
9583
Y_ABORT_UNLESS(ctask.CompactSsts.TargetLevel != (ui32)-1);

ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,15 @@ namespace NKikimr {
480480
} else {
481481
Y_ABORT_UNLESS(RTCtx->LevelIndex->GetCompState() == TLevelIndexBase::StateCompInProgress);
482482

483+
// assign VolatileOrderId for any new SSTables at level 0 to allow merging them to level 0 below
484+
if (const auto& cs = CompactionTask->CompactSsts; cs.TargetLevel == 0) {
485+
for (auto& seg : msg->SegVec->Segments) {
486+
const ui64 prev = std::exchange(seg->VolatileOrderId,
487+
++RTCtx->LevelIndex->CurSlice->Ctx->VolatileOrderId);
488+
Y_ABORT_UNLESS(prev == 0);
489+
}
490+
}
491+
483492
CompactionTask->CompactSsts.CompactionFinished(std::move(msg->SegVec),
484493
std::move(msg->FreedHugeBlobs), std::move(msg->AllocatedHugeBlobs), msg->Aborted);
485494

0 commit comments

Comments
 (0)