Skip to content

Commit 9533b70

Browse files
committed
no use CachedBlockChunkQuerier when query time range is completely after the last sample added in the head
Signed-off-by: alanprot <[email protected]>
1 parent 0e17f08 commit 9533b70

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/ingester/ingester.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,6 +2291,11 @@ func (i *Ingester) blockChunkQuerierFunc(userId string) tsdb.BlockChunkQuerierFu
22912291
if db != nil {
22922292
postingCache = db.postingCache
22932293
}
2294+
2295+
// Caching expanded postings for queries that are "in the future" may lead to incorrect results being cached.
2296+
// This occurs because the tsdb.PostingsForMatchers function can return invalid data in such scenarios.
2297+
// For more details, see: https://github.com/cortexproject/cortex/issues/6556
2298+
// TODO: alanprot: Consider removing this logic when prometheus is updated as this logic is "fixed" upstream.
22942299
if postingCache == nil || mint > db.Head().MaxTime() {
22952300
return tsdb.NewBlockChunkQuerier(b, mint, maxt)
22962301
}

0 commit comments

Comments
 (0)