aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Rutkovsky <alexvru@ydb.tech>2025-03-24 18:39:36 +0300
committerGitHub <noreply@github.com>2025-03-24 15:39:36 +0000
commitb3b79e741d09e6d380de1433a433f6a19a4567c0 (patch)
treedaf4c848c0b7284d9148eea772aa4a70aedd2159
parent6ea5cd00a403b5f9e159baa1ffcce5ab028a5220 (diff)
downloadydb-b3b79e741d09e6d380de1433a433f6a19a4567c0.tar.gz
Fix VDisk compaction bug (#16151)
-rw-r--r--ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h12
-rw-r--r--ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp9
2 files changed, 9 insertions, 12 deletions
diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h
index a97d661cb29..768e88bebbd 100644
--- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h
+++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_buildslice.h
@@ -78,18 +78,6 @@ namespace NKikimr {
// create a new slice
TLevelSlicePtr res(new TLevelSlice(settings, slice->Ctx));
- // assign VolatileOrderId for any new SSTables at level 0 to allow merging them to level 0 below
- {
- for (auto it = addIt; it.Valid(); it.Next()) {
- if (const auto& table = it.Get(); !table.Level) {
- const ui64 prev = std::exchange(table.SstPtr->VolatileOrderId, ++slice->Ctx->VolatileOrderId);
- Y_ABORT_UNLESS(prev == 0);
- } else { // items are sorted in ascending order of Level
- break;
- }
- }
- }
-
ui32 levelsSize = slice->SortedLevels.size();
if (ctask.Action == NHullComp::ActCompactSsts) {
Y_ABORT_UNLESS(ctask.CompactSsts.TargetLevel != (ui32)-1);
diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp
index ccebfeb77c0..090fbce1792 100644
--- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp
+++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullactor.cpp
@@ -480,6 +480,15 @@ namespace NKikimr {
} else {
Y_ABORT_UNLESS(RTCtx->LevelIndex->GetCompState() == TLevelIndexBase::StateCompInProgress);
+ // assign VolatileOrderId for any new SSTables at level 0 to allow merging them to level 0 below
+ if (const auto& cs = CompactionTask->CompactSsts; cs.TargetLevel == 0) {
+ for (auto& seg : msg->SegVec->Segments) {
+ const ui64 prev = std::exchange(seg->VolatileOrderId,
+ ++RTCtx->LevelIndex->CurSlice->Ctx->VolatileOrderId);
+ Y_ABORT_UNLESS(prev == 0);
+ }
+ }
+
CompactionTask->CompactSsts.CompactionFinished(std::move(msg->SegVec),
std::move(msg->FreedHugeBlobs), std::move(msg->AllocatedHugeBlobs), msg->Aborted);