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

Implement result cache for tenant query federation #3640

Conversation

simonswine
Copy link
Contributor

What this PR does:

Tenant query federation PR #3250 did skip result caching for tenant query federation. This PR will implement it.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@simonswine simonswine force-pushed the 20201231_implement_result_cache_for_tenant_query_federation branch from fe80a5a to 5a2f935 Compare December 31, 2020 14:44
Copy link
Contributor

@jtlisi jtlisi left a comment

Choose a reason for hiding this comment

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

LGTM besides some minor nits.

Also could you add a [ENHANCEMENT] entry to the CHANGELOG describing the change in behaviour.

docs/guides/limitations.md Show resolved Hide resolved
pkg/util/validation/limits.go Outdated Show resolved Hide resolved
@pstibrany
Copy link
Contributor

@sandeepsukhani Would you mind taking a look at this PR please?

Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Changes look good to me, but I would prefer if @sandeepsukhani took a look as well, as he is an expert on this stuff.


// set results number string if it's higher than the ones before
if numbers.results != "" {
results, err := strconv.Atoi(numbers.results)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused by this... is this value guaranteed to be an incrementing number?

update: comment above says cacheGenNumbers holds store and results cache gen numbers for a user.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the gen numbers are actually timestamps, we simply set them to current timestamp whenever we need to change it.

pkg/util/validation/limits.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

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

The changes look good to me.

Signed-off-by: Christian Simon <simon@swine.de>
@simonswine simonswine force-pushed the 20201231_implement_result_cache_for_tenant_query_federation branch from 5a2f935 to 29ac099 Compare January 6, 2021 13:06
Copy link
Contributor

@jtlisi jtlisi left a comment

Choose a reason for hiding this comment

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

LGTM

@pstibrany pstibrany merged commit a814306 into cortexproject:master Jan 6, 2021
if numbers.results != "" {
results, err := strconv.Atoi(numbers.results)
if err != nil {
level.Error(util.Logger).Log("msg", "error parsing resultsCacheGenNumber", "tenant", tenantID, "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Across the code base, the tenant ID is logged with the field name user instead of tenant. Do you mind fixing this for consistency, please?

Same comment applies below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point see: #3680

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

5 participants