Skip to content

Commit 05eec5f

Browse files
committed
changelog/comments
Signed-off-by: Alan Protasio <[email protected]>
1 parent 5a0086a commit 05eec5f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## master / unreleased
44

5+
* [ENHANCEMENT] Querier: Batch Iterator optimization to prevent transversing it multiple times query ranges steps does not overlap. #5237
6+
57
## 1.15.0 in progress
68

79
* [CHANGE] Storage: Make Max exemplars config per tenant instead of global configuration. #5016

pkg/querier/batch/batch.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ func (a *iteratorAdapter) Seek(t int64) bool {
103103
return true
104104
} else if t <= a.underlying.MaxCurrentChunkTime() {
105105
// In this case, some timestamp inside the current underlying chunk can fulfill the seek.
106-
// In this case we will call next until we find the sample as it will be faster than calling seek directly.
106+
// In this case we will call next until we find the sample as it will be faster than calling
107+
// `a.underlying.Seek` directly as this would cause the iterator to start from the beginning of the chunk.
108+
// See: https://github.com/cortexproject/cortex/blob/f69452975877c67ac307709e5f60b8d20477764c/pkg/querier/batch/chunk.go#L26-L45
109+
// https://github.com/cortexproject/cortex/blob/f69452975877c67ac307709e5f60b8d20477764c/pkg/chunk/encoding/prometheus_chunk.go#L90-L95
107110
for a.Next() {
108111
if t <= a.curr.Timestamps[a.curr.Index] {
109112
return true

0 commit comments

Comments
 (0)