From c1acd3fe857aae38a943a4cd189efed0425bd41f Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Wed, 14 Dec 2016 21:43:08 +0100 Subject: [PATCH] Advance buffered iterator correctly on seek --- querier.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/querier.go b/querier.go index 833b42cc28..332c336a22 100644 --- a/querier.go +++ b/querier.go @@ -541,9 +541,14 @@ func (b *BufferedSeriesIterator) Seek(t int64) bool { t0 := t - b.buf.delta // If the delta would cause us to seek backwards, preserve the buffer - // and just continue regular advancment. + // and just continue regular advancment while filling the buffer on the way. if t0 <= tcur { - return b.Next() + for b.Next() { + if tcur, _ = b.it.Values(); tcur >= t { + return true + } + } + return false } b.buf.reset()