Skip to content

Commit 82f8fc2

Browse files
authored
Replace TMemorizableControlWrapper to TControlWrapper (#10005)
Replace TMemorizableControlWrapper to TControlWrapper because of thread-safeness
1 parent ed1e883 commit 82f8fc2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ class TBsCostTracker {
325325
TLight BurstDetector;
326326
std::atomic<ui64> SeqnoBurstDetector = 0;
327327

328-
TMemorizableControlWrapper BurstThresholdNs;
329-
TMemorizableControlWrapper DiskTimeAvailableScale;
328+
TControlWrapper BurstThresholdNs;
329+
TControlWrapper DiskTimeAvailableScale;
330330

331331
public:
332332
TBsCostTracker(const TBlobStorageGroupType& groupType, NPDisk::EDeviceType diskType,
@@ -352,7 +352,7 @@ class TBsCostTracker {
352352
}
353353

354354
void CountRequest(ui64 cost) {
355-
i64 bucketCapacity = GetDiskTimeAvailableScale() * BurstThresholdNs.Update(TAppData::TimeProvider->Now());
355+
i64 bucketCapacity = GetDiskTimeAvailableScale() * BurstThresholdNs;
356356
BucketUpperLimit.store(bucketCapacity);
357357
BucketLowerLimit.store(bucketCapacity * -BucketRelativeMinimum);
358358
Bucket.FillAndTake(cost);
@@ -417,7 +417,7 @@ class TBsCostTracker {
417417

418418
private:
419419
float GetDiskTimeAvailableScale() {
420-
return 0.001 * DiskTimeAvailableScale.Update(TAppData::TimeProvider->Now());
420+
return 0.001 * DiskTimeAvailableScale;
421421
}
422422
};
423423

ydb/core/control/immediate_control_board_wrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TControlWrapper {
4040
}
4141
};
4242

43+
// WARNING: not thread safe
4344
class TMemorizableControlWrapper {
4445
static constexpr i32 RequestCountWithRelevantValue = 1024;
4546
static constexpr TDuration TimeDurationWithRelevantValue = TDuration::Seconds(15);

0 commit comments

Comments
 (0)