@cryptotaxi247 / netdata-1 / commits / 31e7d8554

fix retention loading (#16290)

Costa Tsaousis committed Oct 28, 2023 at 04:38 UTC 31e7d8554788f4ca5d5045c6d99b19f15d526f52
1 file changed +4 -4
database/engine/metric.c
+4 -4
@@ -402,10 +402,10 @@ inline void mrg_metric_expand_retention(MRG *mrg __maybe_unused, METRIC *metric,
402 "DBENGINE METRIC: metric last time is in the future");
403
404 if(first_time_s > 0)
405 - set_metric_field_with_condition(metric->first_time_s, first_time_s, _current <= 0 || first_time_s > _current);
405 + set_metric_field_with_condition(metric->first_time_s, first_time_s, _current <= 0 || _wanted < _current);
406
407 if(last_time_s > 0) {
408 - if(set_metric_field_with_condition(metric->latest_time_s_clean, last_time_s, _current <= 0 || last_time_s > _current) &&
408 + if(set_metric_field_with_condition(metric->latest_time_s_clean, last_time_s, _current <= 0 || _wanted > _current) &&
409 update_every_s > 0)
410 // set the latest update every too
411 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,
417
418 inline bool mrg_metric_set_first_time_s_if_bigger(MRG *mrg __maybe_unused, METRIC *metric, time_t first_time_s) {
419 internal_fatal(first_time_s < 0, "DBENGINE METRIC: timestamp is negative");
420 - return set_metric_field_with_condition(metric->first_time_s, first_time_s, first_time_s > _current);
420 + return set_metric_field_with_condition(metric->first_time_s, first_time_s, _wanted > _current);
421 }
422
423 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 *
444
445 if(latest_time_s > 0) {
446 if(set_metric_field_with_condition(metric->latest_time_s_clean, latest_time_s, true)) {
447 - set_metric_field_with_condition(metric->first_time_s, latest_time_s, _current <= 0 || latest_time_s < _current);
447 + set_metric_field_with_condition(metric->first_time_s, latest_time_s, _current <= 0 || _wanted < _current);
448
449 return true;
450 }