Skip to content

Commit 4fdd550

Browse files
Fix ICB MaxChunksToDefragInflight (#21322) (#21483)
Co-authored-by: Vlad Kuznetsov <[email protected]>
1 parent d5c70ce commit 4fdd550

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

ydb/core/blobstorage/nodewarden/node_warden_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ namespace NKikimr::NStorage {
186186
, MaxSyncLogChunksInFlightSSD(10, 1, 1024)
187187
, DefaultHugeGarbagePerMille(300, 1, 1000)
188188
, HugeDefragFreeSpaceBorderPerMille(260, 1, 1000)
189-
, MaxChunksToDefragInflight(10, 1, 50)
189+
, MaxChunksToDefragInflight(10, 1, 1000)
190190
, EnableExplicitCompactionAfterDefrag(1, 0, 1)
191191
, FreshCompMaxInFlightWrites(10, 1, 1000)
192192
, HullCompMaxInFlightWrites(10, 1, 1000)

ydb/core/blobstorage/vdisk/defrag/defrag_actor.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace NKikimr {
3030
, HugeKeeperId(hugeKeeperId)
3131
, DefragMonGroup(VCtx->VDiskCounters, "subsystem", "defrag")
3232
, RunDefragBySchedule(runDefrageBySchedule)
33-
, MaxChunksToDefrag(vconfig->MaxChunksToDefragInflight)
3433
{}
3534

3635
TDefragCtx::~TDefragCtx() = default;
@@ -138,8 +137,8 @@ namespace NKikimr {
138137
double hugeDefragFreeSpaceBorder = DCtx->VCfg->HugeDefragFreeSpaceBorderPerMille / 1000.0;
139138
DCtx->DefragMonGroup.DefragThreshold() = DefragThreshold(oos, defaultPercent, hugeDefragFreeSpaceBorder);
140139
if (HugeHeapDefragmentationRequired(oos, canBeFreedChunks, totalChunks, defaultPercent, hugeDefragFreeSpaceBorder)) {
141-
TChunksToDefrag chunksToDefrag = calcStat.GetChunksToDefrag(MaxInflyghtDefragChunks(DCtx->MaxChunksToDefrag, canBeFreedChunks));
142-
Y_ABORT_UNLESS(chunksToDefrag);
140+
TChunksToDefrag chunksToDefrag = calcStat.GetChunksToDefrag(MaxInflyghtDefragChunks(DCtx->VCfg->MaxChunksToDefragInflight, canBeFreedChunks));
141+
Y_VERIFY_S(chunksToDefrag, DCtx->VCtx->VDiskLogPrefix);
143142
STLOG(PRI_INFO, BS_VDISK_DEFRAG, BSVDD03, VDISKP(DCtx->VCtx->VDiskLogPrefix, "scan finished"),
144143
(TotalChunks, totalChunks), (UsefulChunks, usefulChunks),
145144
(LocalColor, NKikimrBlobStorage::TPDiskSpaceColor_E_Name(oos.GetLocalColor())),
@@ -264,12 +263,21 @@ namespace NKikimr {
264263
Sublog.Log() << "=== Starting Defrag ===\n";
265264
}
266265

267-
Sublog.Log() << "Defrag quantum started\n";
266+
auto chunksToDefrag = std::visit([](auto& r) { return GetChunksToDefrag(r); }, task.Request);
267+
if (!chunksToDefrag) {
268+
Sublog.Log() << "Defrag quantum started {nothing} \n";
269+
} else {
270+
Sublog.Log() << "Defrag quantum started"
271+
<< " {chunksSize# " << chunksToDefrag->Chunks.size()
272+
<< " foundChunks# " << chunksToDefrag->FoundChunksToDefrag
273+
<< " estimatedSlots# " << chunksToDefrag->EstimatedSlotsCount
274+
<< " }\n";
275+
}
268276
++TotalDefragRuns;
269277
InProgress = true;
270278
ActiveActors.Insert(ctx.Register(CreateDefragQuantumActor(DCtx,
271279
GInfo->GetVDiskId(DCtx->VCtx->ShortSelfVDisk),
272-
std::visit([](auto& r) { return GetChunksToDefrag(r); }, task.Request), DCtx->VCfg->EnableExplicitCompactionAfterDefrag)), __FILE__, __LINE__,
280+
chunksToDefrag, DCtx->VCfg->EnableExplicitCompactionAfterDefrag)), __FILE__, __LINE__,
273281
ctx, NKikimrServices::BLOBSTORAGE);
274282
}
275283

ydb/core/blobstorage/vdisk/defrag/defrag_actor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ namespace NKikimr {
2626
NMonGroup::TDefragGroup DefragMonGroup;
2727
bool RunDefragBySchedule;
2828

29-
// free up to this number of chunks in one quantum
30-
ui32 MaxChunksToDefrag = 1u;
31-
3229
TDefragCtx(
3330
const TIntrusivePtr<TVDiskContext> &vctx,
3431
const TIntrusivePtr<TVDiskConfig> &vconfig,

ydb/core/blobstorage/vdisk/defrag/defrag_quantum.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ namespace NKikimr {
5656

5757
void RunImpl() {
5858
TEvDefragQuantumResult::TStat stat{.Eof = true};
59+
ui32 maxChunksToDefrag = DCtx->VCfg->MaxChunksToDefragInflight;
5960

6061
if (ChunksToDefrag) {
6162
Y_ABORT_UNLESS(*ChunksToDefrag);
@@ -68,12 +69,12 @@ namespace NKikimr {
6869
}
6970
Yield();
7071
}
71-
ChunksToDefrag.emplace(findChunks.GetChunksToDefrag(DCtx->MaxChunksToDefrag));
72+
ChunksToDefrag.emplace(findChunks.GetChunksToDefrag(maxChunksToDefrag));
7273
}
7374
if (*ChunksToDefrag) {
7475
stat.FoundChunksToDefrag = ChunksToDefrag->FoundChunksToDefrag;
7576
stat.FreedChunks = ChunksToDefrag->Chunks;
76-
stat.Eof = stat.FoundChunksToDefrag < DCtx->MaxChunksToDefrag;
77+
stat.Eof = stat.FoundChunksToDefrag < maxChunksToDefrag;
7778

7879
auto lockedChunks = LockChunks(*ChunksToDefrag);
7980

0 commit comments

Comments
 (0)