Skip to content

Commit 1f7df2f

Browse files
authored
Merge 35f4c09 into e1c9600
2 parents e1c9600 + 35f4c09 commit 1f7df2f

15 files changed

+87
-46
lines changed

ydb/core/blobstorage/nodewarden/node_warden_impl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ void TNodeWarden::Bootstrap() {
193193
icb->RegisterSharedControl(DefaultHugeGarbagePerMille, "VDiskControls.DefaultHugeGarbagePerMille");
194194
icb->RegisterSharedControl(HugeDefragFreeSpaceBorderPerMille, "VDiskControls.HugeDefragFreeSpaceBorderPerMille");
195195
icb->RegisterSharedControl(MaxChunksToDefragInflight, "VDiskControls.MaxChunksToDefragInflight");
196+
icb->RegisterSharedControl(EnableExplicitCompactionAfterDefrag, "VDiskControls.EnableExplicitCompactionAfterDefrag");
197+
icb->RegisterSharedControl(FreshCompMaxInFlightWrites, "VDiskControls.FreshCompMaxInFlightWrites");
198+
icb->RegisterSharedControl(HullCompMaxInFlightWrites, "VDiskControls.HullCompMaxInFlightWrites");
199+
icb->RegisterSharedControl(HullCompMaxInFlightReads, "VDiskControls.HullCompMaxInFlightReads");
196200

197201
icb->RegisterSharedControl(CostMetricsParametersByMedia[NPDisk::DEVICE_TYPE_ROT].BurstThresholdNs,
198202
"VDiskControls.BurstThresholdNsHDD");

ydb/core/blobstorage/nodewarden/node_warden_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ namespace NKikimr::NStorage {
142142
TControlWrapper DefaultHugeGarbagePerMille;
143143
TControlWrapper HugeDefragFreeSpaceBorderPerMille;
144144
TControlWrapper MaxChunksToDefragInflight;
145+
TControlWrapper EnableExplicitCompactionAfterDefrag;
146+
TControlWrapper FreshCompMaxInFlightWrites;
147+
TControlWrapper HullCompMaxInFlightWrites;
148+
TControlWrapper HullCompMaxInFlightReads;
145149

146150
TReplQuoter::TPtr ReplNodeRequestQuoter;
147151
TReplQuoter::TPtr ReplNodeResponseQuoter;

ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ namespace NKikimr::NStorage {
182182
vdiskConfig->DefaultHugeGarbagePerMille = DefaultHugeGarbagePerMille;
183183
vdiskConfig->HugeDefragFreeSpaceBorderPerMille = HugeDefragFreeSpaceBorderPerMille;
184184
vdiskConfig->MaxChunksToDefragInflight = MaxChunksToDefragInflight;
185+
vdiskConfig->EnableExplicitCompactionAfterDefrag = EnableExplicitCompactionAfterDefrag;
186+
vdiskConfig->FreshCompMaxInFlightWrites = FreshCompMaxInFlightWrites;
187+
vdiskConfig->HullCompMaxInFlightWrites = HullCompMaxInFlightWrites;
188+
vdiskConfig->HullCompMaxInFlightReads = HullCompMaxInFlightReads;
185189

186190
vdiskConfig->EnableLocalSyncLogDataCutting = EnableLocalSyncLogDataCutting;
187191
if (deviceType == NPDisk::EDeviceType::DEVICE_TYPE_ROT) {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ namespace NKikimr {
8181
HandoffTimeout = TDuration::Seconds(10);
8282
RunRepl = !baseInfo.ReadOnly;
8383

84-
ReplMaxTimeToMakeProgress = VDiskPerformance.at(baseInfo.DeviceType).ReplMaxTimeToMakeProgress;
84+
if (const auto& perf = VDiskPerformance.find(baseInfo.DeviceType); perf != VDiskPerformance.end()) {
85+
ReplMaxTimeToMakeProgress = perf->second.ReplMaxTimeToMakeProgress;
86+
} else {
87+
ReplMaxTimeToMakeProgress = TDuration::Minutes(180);
88+
}
8589

8690
SkeletonFrontGets_MaxInFlightCount = 24;
8791
SkeletonFrontGets_MaxInFlightCost = 200000000; // 200ms

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ namespace NKikimr {
126126
ui32 HullCompSortedPartsNum;
127127
double HullCompLevelRateThreshold;
128128
double HullCompFreeSpaceThreshold;
129-
ui32 FreshCompMaxInFlightWrites;
130-
ui32 HullCompMaxInFlightWrites;
131-
ui32 HullCompMaxInFlightReads;
129+
TControlWrapper FreshCompMaxInFlightWrites;
130+
TControlWrapper HullCompMaxInFlightWrites;
131+
TControlWrapper HullCompMaxInFlightReads;
132132
double HullCompReadBatchEfficiencyThreshold;
133133
ui64 AnubisOsirisMaxInFly;
134134
bool AddHeader;
@@ -239,6 +239,7 @@ namespace NKikimr {
239239
TControlWrapper DefaultHugeGarbagePerMille = 300;
240240
TControlWrapper HugeDefragFreeSpaceBorderPerMille = 260;
241241
TControlWrapper MaxChunksToDefragInflight = 10;
242+
TControlWrapper EnableExplicitCompactionAfterDefrag = 1;
242243

243244
///////////// COST METRICS SETTINGS ////////////////
244245
bool UseCostTracker = true;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ namespace NKikimr {
269269
InProgress = true;
270270
ActiveActors.Insert(ctx.Register(CreateDefragQuantumActor(DCtx,
271271
GInfo->GetVDiskId(DCtx->VCtx->ShortSelfVDisk),
272-
std::visit([](auto& r) { return GetChunksToDefrag(r); }, task.Request))), __FILE__, __LINE__,
272+
std::visit([](auto& r) { return GetChunksToDefrag(r); }, task.Request), DCtx->VCfg->EnableExplicitCompactionAfterDefrag)), __FILE__, __LINE__,
273273
ctx, NKikimrServices::BLOBSTORAGE);
274274
}
275275

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace NKikimr {
1919
std::shared_ptr<TDefragCtx> DCtx;
2020
const TVDiskID SelfVDiskId;
2121
std::optional<TChunksToDefrag> ChunksToDefrag;
22+
bool NeedCompaction;
2223

2324
enum {
2425
EvResume = EventSpaceBegin(TEvents::ES_PRIVATE)
@@ -28,11 +29,12 @@ namespace NKikimr {
2829

2930
public:
3031
TDefragQuantum(const std::shared_ptr<TDefragCtx>& dctx, const TVDiskID& selfVDiskId,
31-
std::optional<TChunksToDefrag> chunksToDefrag)
32+
std::optional<TChunksToDefrag> chunksToDefrag, bool needCompaction)
3233
: TActorCoroImpl(64_KB, true)
3334
, DCtx(dctx)
3435
, SelfVDiskId(selfVDiskId)
3536
, ChunksToDefrag(std::move(chunksToDefrag))
37+
, NeedCompaction(needCompaction)
3638
{}
3739

3840
void ProcessUnexpectedEvent(TAutoPtr<IEventHandle> ev) {
@@ -92,7 +94,9 @@ namespace NKikimr {
9294
stat.RewrittenRecs = ev->Get()->RewrittenRecs;
9395
stat.RewrittenBytes = ev->Get()->RewrittenBytes;
9496

95-
Compact();
97+
if (NeedCompaction) {
98+
Compact();
99+
}
96100

97101
auto hugeStat = GetHugeStat();
98102
Y_DEBUG_ABORT_UNLESS(hugeStat.LockedChunks.size() < 100);
@@ -129,8 +133,8 @@ namespace NKikimr {
129133
};
130134

131135
IActor *CreateDefragQuantumActor(const std::shared_ptr<TDefragCtx>& dctx, const TVDiskID& selfVDiskId,
132-
std::optional<TChunksToDefrag> chunksToDefrag) {
133-
return new TActorCoro(MakeHolder<TDefragQuantum>(dctx, selfVDiskId, std::move(chunksToDefrag)),
136+
std::optional<TChunksToDefrag> chunksToDefrag, bool needCompaction) {
137+
return new TActorCoro(MakeHolder<TDefragQuantum>(dctx, selfVDiskId, std::move(chunksToDefrag), needCompaction),
134138
NKikimrServices::TActivity::BS_DEFRAG_QUANTUM);
135139
}
136140

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace NKikimr {
3535
struct TChunksToDefrag;
3636

3737
IActor *CreateDefragQuantumActor(const std::shared_ptr<TDefragCtx>& dctx, const TVDiskID& selfVDiskId,
38-
std::optional<TChunksToDefrag> chunksToDefrag);
38+
std::optional<TChunksToDefrag> chunksToDefrag, bool needCompaction);
3939

4040
} // NKikimr
4141

ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ namespace NKikimr {
8585
str << "{Id# " << Id << "}";
8686
}
8787

88-
THullCtx::THullCtx(TVDiskContextPtr vctx, ui32 chunkSize, ui32 compWorthReadSize, bool freshCompaction,
89-
bool gcOnlySynced, bool allowKeepFlags, bool barrierValidation, ui32 hullSstSizeInChunksFresh,
90-
ui32 hullSstSizeInChunksLevel, double hullCompFreeSpaceThreshold, ui32 freshCompMaxInFlightWrites,
91-
ui32 hullCompMaxInFlightWrites, ui32 hullCompMaxInFlightReads, double hullCompReadBatchEfficiencyThreshold,
88+
THullCtx::THullCtx(TVDiskContextPtr vctx, const TIntrusivePtr<TVDiskConfig> vcfg, ui32 chunkSize, ui32 compWorthReadSize,
89+
bool freshCompaction, bool gcOnlySynced, bool allowKeepFlags, bool barrierValidation, ui32 hullSstSizeInChunksFresh,
90+
ui32 hullSstSizeInChunksLevel, double hullCompFreeSpaceThreshold, double hullCompReadBatchEfficiencyThreshold,
9291
TDuration hullCompStorageRatioCalcPeriod, TDuration hullCompStorageRatioMaxCalcDuration, bool addHeader)
9392
: VCtx(std::move(vctx))
93+
, VCfg(vcfg)
9494
, IngressCache(TIngressCache::Create(VCtx->Top, VCtx->ShortSelfVDisk))
9595
, ChunkSize(chunkSize)
9696
, CompWorthReadSize(compWorthReadSize)
@@ -101,9 +101,6 @@ namespace NKikimr {
101101
, HullSstSizeInChunksFresh(hullSstSizeInChunksFresh)
102102
, HullSstSizeInChunksLevel(hullSstSizeInChunksLevel)
103103
, HullCompFreeSpaceThreshold(hullCompFreeSpaceThreshold)
104-
, FreshCompMaxInFlightWrites(freshCompMaxInFlightWrites)
105-
, HullCompMaxInFlightWrites(hullCompMaxInFlightWrites)
106-
, HullCompMaxInFlightReads(hullCompMaxInFlightReads)
107104
, HullCompReadBatchEfficiencyThreshold(hullCompReadBatchEfficiencyThreshold)
108105
, HullCompStorageRatioCalcPeriod(hullCompStorageRatioCalcPeriod)
109106
, HullCompStorageRatioMaxCalcDuration(hullCompStorageRatioMaxCalcDuration)

ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ namespace NKikimr {
121121
///////////////////////////////////////////////////////////////////////////////////////
122122
struct THullCtx : public TThrRefBase {
123123
TVDiskContextPtr VCtx;
124+
const TIntrusivePtr<TVDiskConfig> VCfg;
124125
const TIntrusivePtr<TIngressCache> IngressCache;
125126
const ui32 ChunkSize;
126127
const ui32 CompWorthReadSize;
@@ -131,9 +132,6 @@ namespace NKikimr {
131132
const ui32 HullSstSizeInChunksFresh;
132133
const ui32 HullSstSizeInChunksLevel;
133134
const double HullCompFreeSpaceThreshold;
134-
const ui32 FreshCompMaxInFlightWrites;
135-
const ui32 HullCompMaxInFlightWrites;
136-
const ui32 HullCompMaxInFlightReads;
137135
const double HullCompReadBatchEfficiencyThreshold;
138136
const TDuration HullCompStorageRatioCalcPeriod;
139137
const TDuration HullCompStorageRatioMaxCalcDuration;
@@ -144,6 +142,7 @@ namespace NKikimr {
144142

145143
THullCtx(
146144
TVDiskContextPtr vctx,
145+
const TIntrusivePtr<TVDiskConfig> vcfg,
147146
ui32 chunkSize,
148147
ui32 compWorthReadSize,
149148
bool freshCompaction,
@@ -153,9 +152,6 @@ namespace NKikimr {
153152
ui32 hullSstSizeInChunksFresh,
154153
ui32 hullSstSizeInChunksLevel,
155154
double hullCompFreeSpaceThreshold,
156-
ui32 freshCompMaxInFlightWrites,
157-
ui32 hullCompMaxInFlightWrites,
158-
ui32 hullCompMaxInFlightReads,
159155
double hullCompReadBatchEfficiencyThreshold,
160156
TDuration hullCompStorageRatioCalcPeriod,
161157
TDuration hullCompStorageRatioMaxCalcDuration,

0 commit comments

Comments
 (0)