querier: Use select params for mint and maxt#1012
Merged
tomwilkie merged 1 commit intocortexproject:masterfrom Sep 23, 2018
Merged
querier: Use select params for mint and maxt#1012tomwilkie merged 1 commit intocortexproject:masterfrom
tomwilkie merged 1 commit intocortexproject:masterfrom
Conversation
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
Contributor
|
I can't see anything wrong with this! Lets get it into dev... |
bboreham
reviewed
Sep 19, 2018
| func (q *chunkStoreQuerier) Select(_ *storage.SelectParams, matchers ...*labels.Matcher) (storage.SeriesSet, error) { | ||
| chunks, err := q.store.Get(q.ctx, model.Time(q.mint), model.Time(q.maxt), matchers...) | ||
| func (q *chunkStoreQuerier) Select(sp *storage.SelectParams, matchers ...*labels.Matcher) (storage.SeriesSet, error) { | ||
| chunks, err := q.store.Get(q.ctx, model.Time(sp.Start), model.Time(sp.End), matchers...) |
Contributor
There was a problem hiding this comment.
should this check that sp != nil ? Maybe it can't be today, but it seems safer to follow the general pattern.
Contributor
There was a problem hiding this comment.
This is only call by querier.go (Select), which includes that check. Calling this with nil should panic IMO. The only "root" queriers are the ones in querier.go and unified_querier.go, where the nil check need to be.
Contributor
Author
|
This has been running in prod over the last couple of days and everything looks good! |
tomwilkie
approved these changes
Sep 23, 2018
bwplotka
added a commit
to thanos-io/thanos
that referenced
this pull request
Oct 22, 2019
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka
added a commit
to thanos-io/thanos
that referenced
this pull request
Oct 22, 2019
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka
added a commit
to thanos-io/thanos
that referenced
this pull request
Oct 22, 2019
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
brancz
pushed a commit
to thanos-io/thanos
that referenced
this pull request
Oct 22, 2019
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
GiedriusS
pushed a commit
to thanos-io/thanos
that referenced
this pull request
Oct 28, 2019
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com> Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR; So turns out, if there was query like
up offset 4wbutstart-end = 15s, we would end up getting all the chunks fromstart-4wtoend. This PR makes sure only the relevant chunks are requested.This is because when we create a
Querierdue to TSDB constraints (and maybe for other reasons), we need a single querier for a query. Which means if weX / YwhereXhasoffset 4wandYdoesn't, theq.minTime, andq.maxTimewill need to span the entire4w.But this is mitigated by setting the appropriate parameters on
SelectParamswhich this PR makes sure we use.Relevant promQL code:
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L465-L467
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L472
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L491-L495