summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2021-11-22 16:13:33 +0200
committerGitHub <noreply@github.com>2021-11-22 16:13:33 +0200
commitc511d98c34f6cfde537f75ff71d5e1cb015ec45b (patch)
tree3bc6dc7ebad5ceea3391c5c1595d61485739e525 /database
parent54c8ccf37798839e687c535a225eb362cfce80f5 (diff)
Simple fix for the data API query (#11787)
Diffstat (limited to 'database')
-rw-r--r--database/rrd.h5
-rw-r--r--database/rrdset.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/database/rrd.h b/database/rrd.h
index 62edec423f..7f8b91f7d2 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -1150,7 +1150,10 @@ static inline time_t rrdset_first_entry_t_nolock(RRDSET *st)
time_t first_entry_t = LONG_MAX;
rrddim_foreach_read(rd, st) {
- first_entry_t = MIN(first_entry_t, rd->state->query_ops.oldest_time(rd));
+ first_entry_t =
+ MIN(first_entry_t,
+ rd->state->query_ops.oldest_time(rd) > st->update_every ?
+ rd->state->query_ops.oldest_time(rd) - st->update_every : 0);
}
if (unlikely(LONG_MAX == first_entry_t)) return 0;
diff --git a/database/rrdset.c b/database/rrdset.c
index 25f0bcb7dc..2d3ee96091 100644
--- a/database/rrdset.c
+++ b/database/rrdset.c
@@ -1362,6 +1362,7 @@ static inline void rrdset_done_fill_the_gap(RRDSET *st) {
st->last_updated.tv_sec += c * st->update_every;
st->current_entry += c;
+ st->counter += c;
if(st->current_entry >= st->entries)
st->current_entry -= st->entries;
}