@cryptotaxi247 / netdata-1 / commits / 1d598c9c3

Handle cases where metric timestamps are inversed and data collection interval rounds to 0 (#7008)

Markos Fountoulakis committed Oct 7, 2019 at 16:02 UTC 1d598c9c38a07979de6ebec76cf7bac6b439bad3
1 file changed +4 -3
database/engine/rrdengineapi.c
+4 -3
@@ -309,8 +309,9 @@ unsigned rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t e
309 curr = &page_info_array[i];
310 *pginfo_to_points(curr) = 0; /* initialize to invalid page */
311 *pginfo_to_dt(curr) = 0; /* no known data collection interval yet */
312 - if (unlikely(INVALID_TIME == curr->start_time || INVALID_TIME == curr->end_time)) {
313 - info("Ignoring page with invalid timestamp.");
312 + if (unlikely(INVALID_TIME == curr->start_time || INVALID_TIME == curr->end_time ||
313 + curr->end_time < curr->start_time)) {
314 + info("Ignoring page with invalid timestamps.");
315 prev = old_prev;
316 continue;
317 }
@@ -363,7 +364,7 @@ unsigned rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t e
364 continue;
365 }
366
366 - if (unlikely(0 == dt)) { /* unknown data collection interval */
367 + if (unlikely(0 == *pginfo_to_dt(curr))) { /* unknown data collection interval */
368 assert(1 == page_points);
369
370 if (likely(NULL != prev)) { /* get interval from previous page */