Skip to content

Commit

Permalink
Decrease number of inflyght chunks to defrag while disk space green
Browse files Browse the repository at this point in the history
  • Loading branch information
robdrynkin committed Oct 21, 2024
1 parent 51157be commit 1ab736a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ydb/core/blobstorage/vdisk/defrag/defrag_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ namespace NKikimr {
return HugeHeapDefragmentationRequired(hugeCanBeFreedChunks, hugeTotalChunks, defragThreshold);
}

ui32 MaxInflyghtDefragChunks(const TOutOfSpaceState& oos, ui32 maxChunksToDefrag) {
if (oos.GetLocalColor() > TSpaceColor::GREEN) {
return maxChunksToDefrag;
} else {
return 1;
}
}

////////////////////////////////////////////////////////////////////////////
// TDefragLocalScheduler
// We use statistics about free space share and numbe of used/canBeFreed chunks
Expand Down Expand Up @@ -131,7 +139,7 @@ namespace NKikimr {
double hugeDefragFreeSpaceBorder = DCtx->VCfg->HugeDefragFreeSpaceBorderPerMille / 1000.0;
DCtx->DefragMonGroup.DefragThreshold() = DefragThreshold(oos, defaultPercent, hugeDefragFreeSpaceBorder);
if (HugeHeapDefragmentationRequired(oos, canBeFreedChunks, totalChunks, defaultPercent, hugeDefragFreeSpaceBorder)) {
TChunksToDefrag chunksToDefrag = calcStat.GetChunksToDefrag(DCtx->MaxChunksToDefrag);
TChunksToDefrag chunksToDefrag = calcStat.GetChunksToDefrag(MaxInflyghtDefragChunks(oos, DCtx->MaxChunksToDefrag));
Y_ABORT_UNLESS(chunksToDefrag);
STLOG(PRI_INFO, BS_VDISK_DEFRAG, BSVDD03, VDISKP(DCtx->VCtx->VDiskLogPrefix, "scan finished"),
(TotalChunks, totalChunks), (UsefulChunks, usefulChunks),
Expand Down

0 comments on commit 1ab736a

Please sign in to comment.