aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Drynkin <robdrynkin@ydb.tech>2024-04-15 21:32:28 +0200
committerGitHub <noreply@github.com>2024-04-15 21:32:28 +0200
commit25a9b471fa8ac56593bb22c033bc33dfb155826e (patch)
treed9b30fdb97f4f8033fdb827c0c26a2f44d07a777
parent654d7eb2d3e078c2fe439a0339c9a36f1e0b6314 (diff)
downloadydb-25a9b471fa8ac56593bb22c033bc33dfb155826e.tar.gz
Fix iteration in handoff map and balancing sender/deleter completion (#3750)
-rw-r--r--ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp2
-rw-r--r--ydb/core/blobstorage/vdisk/balance/handoff_map.h12
-rw-r--r--ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h8
3 files changed, 16 insertions, 6 deletions
diff --git a/ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp b/ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp
index bb17b9491c..ff14300f9b 100644
--- a/ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp
+++ b/ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp
@@ -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;
}
diff --git a/ydb/core/blobstorage/vdisk/balance/handoff_map.h b/ydb/core/blobstorage/vdisk/balance/handoff_map.h
index c05983b4cd..ddb8f2b510 100644
--- a/ydb/core/blobstorage/vdisk/balance/handoff_map.h
+++ b/ydb/core/blobstorage/vdisk/balance/handoff_map.h
@@ -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);
}
@@ -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);
}
diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
index 449e21bc49..7ebfb73f63 100644
--- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
+++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h
@@ -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;
}