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
Implement result cache for tenant query federation #3640
Conversation
fe80a5a
to
5a2f935
Compare
There was a problem hiding this 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.
@sandeepsukhani Would you mind taking a look at this PR please? |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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>
5a2f935
to
29ac099
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point see: #3680
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
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]