diff options
author | mregrock <mregrock@ydb.tech> | 2024-10-03 16:51:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-03 16:51:48 +0300 |
commit | 82f8fc22dc338d1af6a6f0342fe51e9c2c26928a (patch) | |
tree | 5b3e6bdeb44d1fbe3c96f3a5af512c6821334a61 | |
parent | ed1e8830077f708ab7ddccdf9f2ef6871da9e76a (diff) | |
download | ydb-82f8fc22dc338d1af6a6f0342fe51e9c2c26928a.tar.gz |
Replace TMemorizableControlWrapper to TControlWrapper (#10005)
Replace TMemorizableControlWrapper to TControlWrapper because of thread-safeness
-rw-r--r-- | ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h | 8 | ||||
-rw-r--r-- | ydb/core/control/immediate_control_board_wrapper.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h b/ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h index 690167b3377..466103d4b8c 100644 --- a/ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h +++ b/ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h @@ -325,8 +325,8 @@ private: TLight BurstDetector; std::atomic<ui64> SeqnoBurstDetector = 0; - TMemorizableControlWrapper BurstThresholdNs; - TMemorizableControlWrapper DiskTimeAvailableScale; + TControlWrapper BurstThresholdNs; + TControlWrapper DiskTimeAvailableScale; public: TBsCostTracker(const TBlobStorageGroupType& groupType, NPDisk::EDeviceType diskType, @@ -352,7 +352,7 @@ public: } void CountRequest(ui64 cost) { - i64 bucketCapacity = GetDiskTimeAvailableScale() * BurstThresholdNs.Update(TAppData::TimeProvider->Now()); + i64 bucketCapacity = GetDiskTimeAvailableScale() * BurstThresholdNs; BucketUpperLimit.store(bucketCapacity); BucketLowerLimit.store(bucketCapacity * -BucketRelativeMinimum); Bucket.FillAndTake(cost); @@ -417,7 +417,7 @@ public: private: float GetDiskTimeAvailableScale() { - return 0.001 * DiskTimeAvailableScale.Update(TAppData::TimeProvider->Now()); + return 0.001 * DiskTimeAvailableScale; } }; diff --git a/ydb/core/control/immediate_control_board_wrapper.h b/ydb/core/control/immediate_control_board_wrapper.h index e2da0d80d00..d598bf8c81f 100644 --- a/ydb/core/control/immediate_control_board_wrapper.h +++ b/ydb/core/control/immediate_control_board_wrapper.h @@ -40,6 +40,7 @@ public: } }; +// WARNING: not thread safe class TMemorizableControlWrapper { static constexpr i32 RequestCountWithRelevantValue = 1024; static constexpr TDuration TimeDurationWithRelevantValue = TDuration::Seconds(15); |