diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-10-28 04:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-28 06:38:46 +0300 |
commit | 31e7d8554788f4ca5d5045c6d99b19f15d526f52 (patch) | |
tree | af99908562c76a6da50283eda029d0c0579a13a1 /database | |
parent | ae749d916761b88d4117d0bb09c6933bafb9bd1c (diff) |
fix retention loading (#16290)
Diffstat (limited to 'database')
-rw-r--r-- | database/engine/metric.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/database/engine/metric.c b/database/engine/metric.c index 42ac428bde..38d14aceb0 100644 --- a/database/engine/metric.c +++ b/database/engine/metric.c @@ -402,10 +402,10 @@ inline void mrg_metric_expand_retention(MRG *mrg __maybe_unused, METRIC *metric, "DBENGINE METRIC: metric last time is in the future"); if(first_time_s > 0) - set_metric_field_with_condition(metric->first_time_s, first_time_s, _current <= 0 || first_time_s > _current); + set_metric_field_with_condition(metric->first_time_s, first_time_s, _current <= 0 || _wanted < _current); if(last_time_s > 0) { - if(set_metric_field_with_condition(metric->latest_time_s_clean, last_time_s, _current <= 0 || last_time_s > _current) && + if(set_metric_field_with_condition(metric->latest_time_s_clean, last_time_s, _current <= 0 || _wanted > _current) && update_every_s > 0) // set the latest update every too set_metric_field_with_condition(metric->latest_update_every_s, update_every_s, true); @@ -417,7 +417,7 @@ inline void mrg_metric_expand_retention(MRG *mrg __maybe_unused, METRIC *metric, inline bool mrg_metric_set_first_time_s_if_bigger(MRG *mrg __maybe_unused, METRIC *metric, time_t first_time_s) { internal_fatal(first_time_s < 0, "DBENGINE METRIC: timestamp is negative"); - return set_metric_field_with_condition(metric->first_time_s, first_time_s, first_time_s > _current); + return set_metric_field_with_condition(metric->first_time_s, first_time_s, _wanted > _current); } inline time_t mrg_metric_get_first_time_s(MRG *mrg __maybe_unused, METRIC *metric) { @@ -444,7 +444,7 @@ inline bool mrg_metric_set_clean_latest_time_s(MRG *mrg __maybe_unused, METRIC * if(latest_time_s > 0) { if(set_metric_field_with_condition(metric->latest_time_s_clean, latest_time_s, true)) { - set_metric_field_with_condition(metric->first_time_s, latest_time_s, _current <= 0 || latest_time_s < _current); + set_metric_field_with_condition(metric->first_time_s, latest_time_s, _current <= 0 || _wanted < _current); return true; } |