mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 14:27:27 -08:00
storage: fix bug #10027 in iterators' Seek method
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
b042e29569
commit
0ede6ae321
|
@ -360,6 +360,9 @@ func (c *concreteSeriesIterator) Seek(t int64) bool {
|
||||||
if c.cur == -1 {
|
if c.cur == -1 {
|
||||||
c.cur = 0
|
c.cur = 0
|
||||||
}
|
}
|
||||||
|
if c.cur >= len(c.series.samples) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// No-op check.
|
// No-op check.
|
||||||
if s := c.series.samples[c.cur]; s.Timestamp >= t {
|
if s := c.series.samples[c.cur]; s.Timestamp >= t {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -99,6 +99,9 @@ func (it *listSeriesIterator) Seek(t int64) bool {
|
||||||
if it.idx == -1 {
|
if it.idx == -1 {
|
||||||
it.idx = 0
|
it.idx = 0
|
||||||
}
|
}
|
||||||
|
if it.idx >= it.samples.Len() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// No-op check.
|
// No-op check.
|
||||||
if s := it.samples.Get(it.idx); s.T() >= t {
|
if s := it.samples.Get(it.idx); s.T() >= t {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -159,6 +159,9 @@ func (it *listSeriesIterator) Seek(t int64) bool {
|
||||||
if it.idx == -1 {
|
if it.idx == -1 {
|
||||||
it.idx = 0
|
it.idx = 0
|
||||||
}
|
}
|
||||||
|
if it.idx >= len(it.list) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// No-op check.
|
// No-op check.
|
||||||
if s := it.list[it.idx]; s.T() >= t {
|
if s := it.list[it.idx]; s.T() >= t {
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue