aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2023-08-23 19:10:16 +0300
committerbabenko <babenko@yandex-team.com>2023-08-23 20:05:35 +0300
commit996b0dd4bcdc66f79875f5e91ff9eb1d21d8ad75 (patch)
tree8b5ead6bcc6aa541a4151a7804a13f592f004c9e
parentb06817ec9c498e9c30197f4b15f1afbeb398d4d6 (diff)
downloadydb-996b0dd4bcdc66f79875f5e91ff9eb1d21d8ad75.tar.gz
Better master cache sticky size adjustment; enable dynconfig for master caches
-rw-r--r--yt/yt/core/misc/historic_usage_aggregator.cpp4
-rw-r--r--yt/yt/core/misc/historic_usage_aggregator.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/yt/yt/core/misc/historic_usage_aggregator.cpp b/yt/yt/core/misc/historic_usage_aggregator.cpp
index 04b6d530d5..411a892070 100644
--- a/yt/yt/core/misc/historic_usage_aggregator.cpp
+++ b/yt/yt/core/misc/historic_usage_aggregator.cpp
@@ -54,7 +54,9 @@ void THistoricUsageAggregator::Reset()
void THistoricUsageAggregator::UpdateAt(TInstant now, double value)
{
- YT_VERIFY(now >= LastExponentialMovingAverageUpdateTime_);
+ if (now < LastExponentialMovingAverageUpdateTime_) {
+ return;
+ }
// If LastExponentialMovingAverageUpdateTime_ is zero, this is the first update (after most
// recent reset) and we just want to leave EMA = 0.0, as if there was no previous usage.
diff --git a/yt/yt/core/misc/historic_usage_aggregator.h b/yt/yt/core/misc/historic_usage_aggregator.h
index 6d20d8d019..764e5f3338 100644
--- a/yt/yt/core/misc/historic_usage_aggregator.h
+++ b/yt/yt/core/misc/historic_usage_aggregator.h
@@ -57,6 +57,8 @@ class TAverageHistoricUsageAggregator
{
public:
explicit TAverageHistoricUsageAggregator(TDuration period = TDuration::Seconds(1));
+ TAverageHistoricUsageAggregator(const TAverageHistoricUsageAggregator& other) = default;
+ TAverageHistoricUsageAggregator& operator=(const TAverageHistoricUsageAggregator& other) = default;
void UpdateParameters(THistoricUsageAggregationParameters params);
@@ -65,7 +67,7 @@ public:
void UpdateAt(TInstant now, double value);
private:
- const TDuration Period_;
+ TDuration Period_;
TInstant IntervalStart_ = TInstant::Zero();
double CurrentUsage_ = 0;