Skip to content

Commit

Permalink
Fix iteration in handoff map and balancing sender/deleter completion (y…
Browse files Browse the repository at this point in the history
  • Loading branch information
robdrynkin authored Apr 15, 2024
1 parent 654d7eb commit 25a9b47
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ namespace NBalancing {

if (Stats.SendPartsLeft != 0 || Stats.DeletePartsLeft != 0) {
// sender or deleter has not finished yet
Stats.SendCompleted = Stats.SendPartsLeft == 0;
Stats.DeleteCompleted = Stats.DeletePartsLeft == 0;
ContinueBalancing();
return;
}
Expand Down
12 changes: 10 additions & 2 deletions ydb/core/blobstorage/vdisk/balance/handoff_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ namespace NKikimr {
// Transforms record according to the built handoff map. It returns item we need to write, pointer is
// valid until next call. Nullptr indicates that item is to be removed completely.
const TTransformedItem *Transform(const TKey& key, const TMemRec* memRec,
const TDataMerger* dataMerger, bool /*keepData*/) {
const TDataMerger* dataMerger, bool /*keepData*/, bool keepItem) {
// do nothing by default, all work is done in template specialization for logo blobs
Counter++;
if (!keepItem) {
return nullptr;
}
Y_DEBUG_ABORT_UNLESS(dataMerger->Empty());
return TrRes.SetRaw(key, memRec, dataMerger);
}
Expand Down Expand Up @@ -163,10 +166,15 @@ namespace NKikimr {
const TKeyLogoBlob& key,
const TMemRecLogoBlob* memRec,
const TDataMerger* dataMerger,
bool keepData)
bool keepData,
bool keepItem)
{
Y_DEFER { Counter++; };

if (!keepItem) {
return nullptr;
}

if (!keepData) {
return TrRes.SetRmData(key, memRec, dataMerger);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,11 @@ namespace NKikimr {
IndexMerger.Finish();

// reset transformed item and try to create new one if we want to keep this item
TransformedItem = nullptr;
if (GcmpIt.KeepItem()) {
const bool keepData = GcmpIt.KeepData();
const bool keepData = GcmpIt.KeepData();
const bool keepItem = GcmpIt.KeepItem();
TransformedItem = Hmp->Transform(key, &IndexMerger.GetMemRec(), IndexMerger.GetDataMerger(), keepData, keepItem);
if (keepItem) {
++(keepData ? Statistics.KeepItemsWithData : Statistics.KeepItemsWOData);
TransformedItem = Hmp->Transform(key, &IndexMerger.GetMemRec(), IndexMerger.GetDataMerger(), keepData);
} else {
++Statistics.DontKeepItems;
}
Expand Down

0 comments on commit 25a9b47

Please sign in to comment.