prometheus/promql
Fiona Liao 9b83d8330a
Fix memSafeIterator.Seek() (#8748)
* Add range query test cases

This includes a couple of failing ones that double count some points due
to the iterator seek bug.

Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>

* Add Seek() implementation for memSafeIterator

Previously, calling memSafeIterator.Seek() would call the Seek() method
on its embedded iterator. This was causing the embedded iterator and the
memSafeIterator to get out of sync because when the embedded Seek()
moved to the next element of the embedded iterator, memSafeIterator
didn't "know" about it. memSafeIterator has to "know" when the embedded
iterator has moved to be able to work out when it should be reading from
its buffer rather than the embedded iterator.

Used same logic as for xorIterator.Seek() (which in runtime is used as
the embedded iterator) - return false if the iterator has an error and
try to move to next element if the required time hasn't been reached, or
if no elements have been read yet. The memSafeIterator.Next() method is
being called so memSafeIterator.i is always accurate.

Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>

* Add tsdb package test

Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>

Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
2021-04-27 00:43:22 +02:00
..
fuzz-data textparse: Add fuzzing and fix bug caught 2017-07-07 11:12:17 +02:00
parser Add circular in-memory exemplars storage (#6635) 2021-03-16 15:17:45 +05:30
testdata promql: Add sgn, clamp and last_over_time functions (#8457) 2021-02-20 16:34:52 +01:00
bench_test.go Optimize aggregations in PromQL engine (#8594) 2021-03-19 17:52:29 +01:00
engine.go Optimize aggregations in PromQL engine (#8594) 2021-03-19 17:52:29 +01:00
engine_test.go Fix memSafeIterator.Seek() (#8748) 2021-04-27 00:43:22 +02:00
functions.go Speed delta value without loop to calculate resultValue 2021-02-23 22:28:04 +08:00
functions_test.go Combine Appender.Add and AddFast into a single Append method. (#8489) 2021-02-18 17:37:00 +05:30
fuzz.go Fuzz: limit input size (#7317) 2020-05-31 09:42:56 +02:00
promql_test.go Testify: move to require (#8122) 2020-10-29 09:43:23 +00:00
quantile.go Fix off-by-one error in funcHistogramQuantile / ensureMonotonic (#7393) 2020-06-15 11:32:10 +01:00
query_logger.go promql: Swap order of parseBrokenJSON. (#7718) 2020-08-02 09:48:57 +01:00
query_logger_test.go Testify: move to require (#8122) 2020-10-29 09:43:23 +00:00
test.go Add circular in-memory exemplars storage (#6635) 2021-03-16 15:17:45 +05:30
test_test.go Testify: move to require (#8122) 2020-10-29 09:43:23 +00:00
value.go Move away from testutil, refactor imports (#8087) 2020-10-22 11:00:08 +02:00