Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ydb/core/blobstorage/vdisk/common/vdisk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ namespace NKikimr {
TDuration WhiteboardUpdateInterval;
bool EnableVDiskCooldownTimeout;
TControlWrapper EnableVPatch = true;
TControlWrapper DefaultHugeGarbagePerMille;

///////////// COST METRICS SETTINGS ////////////////
bool UseCostTracker = true;
Expand Down
12 changes: 7 additions & 5 deletions ydb/core/blobstorage/vdisk/defrag/defrag_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ namespace NKikimr {
bool HugeHeapDefragmentationRequired(
const TOutOfSpaceState& oos,
ui32 hugeCanBeFreedChunks,
ui32 hugeTotalChunks) {
ui32 hugeTotalChunks,
double defaultPercent) {

if (hugeCanBeFreedChunks < 10)
return false;

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

if (oos.GetLocalColor() > TSpaceColor::CYAN) {
return percentOfGarbage >= 0.02;
return percentOfGarbage >= Min(0.02, defaultPercent);
} else if (oos.GetLocalColor() > TSpaceColor::GREEN) {
return percentOfGarbage >= 0.15;
return percentOfGarbage >= Min(0.15, defaultPercent);
} else {
return percentOfGarbage >= 0.30;
return percentOfGarbage >= Min(0.30, defaultPercent);
}
}

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