Skip to content

Commit e9da178

Browse files
authored
Merge 1b3c630 into 2757f82
2 parents 2757f82 + 1b3c630 commit e9da178

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ydb/core/blobstorage/vdisk/common/vdisk_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ namespace NKikimr {
218218
TDuration WhiteboardUpdateInterval;
219219
bool EnableVDiskCooldownTimeout;
220220
TControlWrapper EnableVPatch = true;
221+
TControlWrapper DefaultHugeGarbagePerMille;
221222

222223
///////////// COST METRICS SETTINGS ////////////////
223224
bool UseCostTracker = true;

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,20 @@ namespace NKikimr {
4848
bool HugeHeapDefragmentationRequired(
4949
const TOutOfSpaceState& oos,
5050
ui32 hugeCanBeFreedChunks,
51-
ui32 hugeTotalChunks) {
51+
ui32 hugeTotalChunks,
52+
double defaultPercent) {
5253

5354
if (hugeCanBeFreedChunks < 10)
5455
return false;
5556

5657
double percentOfGarbage = static_cast<double>(hugeCanBeFreedChunks) / hugeTotalChunks;
5758

5859
if (oos.GetLocalColor() > TSpaceColor::CYAN) {
59-
return percentOfGarbage >= 0.02;
60+
return percentOfGarbage >= Min(0.02, defaultPercent);
6061
} else if (oos.GetLocalColor() > TSpaceColor::GREEN) {
61-
return percentOfGarbage >= 0.15;
62+
return percentOfGarbage >= Min(0.15, defaultPercent);
6263
} else {
63-
return percentOfGarbage >= 0.30;
64+
return percentOfGarbage >= Min(0.30, defaultPercent);
6465
}
6566
}
6667

@@ -113,7 +114,8 @@ namespace NKikimr {
113114
const auto& oos = DCtx->VCtx->GetOutOfSpaceState();
114115
Y_ABORT_UNLESS(usefulChunks <= totalChunks);
115116
const ui32 canBeFreedChunks = totalChunks - usefulChunks;
116-
if (HugeHeapDefragmentationRequired(oos, canBeFreedChunks, totalChunks)) {
117+
double defaultPercent = DCtx->VCtx->DefaultHugeGarbagePerMille / 1000.0;
118+
if (HugeHeapDefragmentationRequired(oos, canBeFreedChunks, totalChunks, defaultPercent)) {
117119
TChunksToDefrag chunksToDefrag = calcStat.GetChunksToDefrag(DCtx->MaxChunksToDefrag);
118120
Y_ABORT_UNLESS(chunksToDefrag);
119121
STLOG(PRI_INFO, BS_VDISK_DEFRAG, BSVDD03, VDISKP(DCtx->VCtx->VDiskLogPrefix, "scan finished"),

0 commit comments

Comments
 (0)