Skip to content

Commit bc7881d

Browse files
MichaHoffmannsaswatamcode
authored andcommitted
Query: dont pass query hints to avoid triggering pushdown (thanos-io#7392)
If we have a new querier it will create query hints even without the pushdown feature being present anymore. Old sidecars will then trigger query pushdown which leads to broken max,min,max_over_time and min_over_time. Signed-off-by: Michael Hoffmann <[email protected]>
1 parent 9cbe5a2 commit bc7881d

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
1515
- [#7323](https://github.com/thanos-io/thanos/pull/7323) Sidecar: wait for prometheus on startup
1616
- [#6948](https://github.com/thanos-io/thanos/pull/6948) Receive: fix goroutines leak during series requests to thanos store api.
1717
- [#7382](https://github.com/thanos-io/thanos/pull/7382) *: Ensure objstore flag values are masked & disable debug/pprof/cmdline
18+
- [#7392](https://github.com/thanos-io/thanos/pull/7392) Query: fix broken min, max for pre 0.34.1 sidecars
1819

1920
### Added
2021

pkg/query/querier.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,6 @@ func aggrsFromFunc(f string) []storepb.Aggr {
241241
return []storepb.Aggr{storepb.Aggr_COUNT, storepb.Aggr_SUM}
242242
}
243243

244-
func storeHintsFromPromHints(hints *storage.SelectHints) *storepb.QueryHints {
245-
return &storepb.QueryHints{
246-
StepMillis: hints.Step,
247-
Func: &storepb.Func{
248-
Name: hints.Func,
249-
},
250-
Grouping: &storepb.Grouping{
251-
By: hints.By,
252-
Labels: hints.Grouping,
253-
},
254-
Range: &storepb.Range{Millis: hints.Range},
255-
}
256-
}
257-
258244
func (q *querier) Select(ctx context.Context, _ bool, hints *storage.SelectHints, ms ...*labels.Matcher) storage.SeriesSet {
259245
if hints == nil {
260246
hints = &storage.SelectHints{
@@ -351,7 +337,6 @@ func (q *querier) selectFn(ctx context.Context, hints *storage.SelectHints, ms .
351337
ShardInfo: q.shardInfo,
352338
PartialResponseStrategy: q.partialResponseStrategy,
353339
SkipChunks: q.skipChunks,
354-
QueryHints: storeHintsFromPromHints(hints),
355340
}
356341
if q.isDedupEnabled() {
357342
// Soft ask to sort without replica labels and push them at the end of labelset.

pkg/store/prometheus.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,7 @@ func (p *PrometheusStore) Series(r *storepb.SeriesRequest, seriesSrv storepb.Sto
163163
// Don't ask for more than available time. This includes potential `minTime` flag limit.
164164
availableMinTime, _ := p.timestamps()
165165
if r.MinTime < availableMinTime {
166-
// Align min time with the step to avoid missing data when it gets retrieved by the upper layer's PromQL engine.
167-
// This also is necessary when Sidecar uploads a block and then availableMinTime
168-
// becomes a fixed timestamp.
169-
if r.QueryHints != nil && r.QueryHints.StepMillis != 0 {
170-
diff := availableMinTime - r.MinTime
171-
r.MinTime += (diff / r.QueryHints.StepMillis) * r.QueryHints.StepMillis
172-
// Add one more to strictly fit within --min-time -> infinity.
173-
if r.MinTime != availableMinTime {
174-
r.MinTime += r.QueryHints.StepMillis
175-
}
176-
} else {
177-
r.MinTime = availableMinTime
178-
}
166+
r.MinTime = availableMinTime
179167
}
180168

181169
extLsetToRemove := map[string]struct{}{}

0 commit comments

Comments
 (0)