storage: fix bug #10027 in iterators' Seek method

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-12-16 12:07:07 +01:00
parent b042e29569
commit 0ede6ae321
3 changed files with 9 additions and 0 deletions

View File

@ -360,6 +360,9 @@ func (c *concreteSeriesIterator) Seek(t int64) bool {
if c.cur == -1 {
c.cur = 0
}
if c.cur >= len(c.series.samples) {
return false
}
// No-op check.
if s := c.series.samples[c.cur]; s.Timestamp >= t {
return true

View File

@ -99,6 +99,9 @@ func (it *listSeriesIterator) Seek(t int64) bool {
if it.idx == -1 {
it.idx = 0
}
if it.idx >= it.samples.Len() {
return false
}
// No-op check.
if s := it.samples.Get(it.idx); s.T() >= t {
return true

View File

@ -159,6 +159,9 @@ func (it *listSeriesIterator) Seek(t int64) bool {
if it.idx == -1 {
it.idx = 0
}
if it.idx >= len(it.list) {
return false
}
// No-op check.
if s := it.list[it.idx]; s.T() >= t {
return true