Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache key cant be reused when an interval changes #1616

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

owen-d
Copy link
Member

@owen-d owen-d commented Jan 31, 2020

What this PR does / why we need it:
This fixes a small (and probably unrealistic) loophole in the cache key generation code for the result cache. Including the interval used in a cache key will prevent us from ever reusing the same key across querier.split-queries-by-interval (and associated overrides) configuration changes.

For a hypothetical request start value 12 and split intervals 5 and 6, we'd generate the same cache keys because 12/5 == 12/6 in integer division. We now include the 5 and 6 respectively in our cache keys to prevent this collision.

Checklist

  • Tests updated

@codecov-io
Copy link

Codecov Report

Merging #1616 into master will decrease coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1616      +/-   ##
==========================================
- Coverage   61.02%   60.91%   -0.11%     
==========================================
  Files         108      108              
  Lines        8143     8144       +1     
==========================================
- Hits         4969     4961       -8     
- Misses       2786     2791       +5     
- Partials      388      392       +4
Impacted Files Coverage Δ
pkg/querier/queryrange/limits.go 100% <100%> (ø) ⬆️
pkg/promtail/targets/tailer.go 73.56% <0%> (-4.6%) ⬇️
pkg/promtail/targets/filetarget.go 68.71% <0%> (-1.85%) ⬇️
pkg/logql/evaluator.go 91.75% <0%> (-1.04%) ⬇️

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyriltovena cyriltovena merged commit a53477f into grafana:master Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants