-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
use default retention period to check user index may have expired chunks when user does not have custom retention #5261
use default retention period to check user index may have expired chunks when user does not have custom retention #5261
Conversation
…nks when user does not have custom retention
tenantsRetention *TenantsRetention | ||
latestRetentionStartTime model.Time | ||
tenantsRetention *TenantsRetention | ||
// overallLatestRetentionStartTime holds latest retention start time considering both default and per user retention config. |
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.
// overallLatestRetentionStartTime holds latest retention start time considering both default and per user retention config. | |
// overallLatestRetentionStartTime holds latest retention start time for all users considering both default and per user retention config. |
// findLatestRetentionStartTime returns the latest retention start time overall and by each user. | ||
func findLatestRetentionStartTime(now model.Time, limits Limits) (model.Time, map[string]model.Time) { | ||
// findLatestRetentionStartTime returns the latest retention start time overall, just default config and by each user. | ||
func findLatestRetentionStartTime(now model.Time, limits Limits) (model.Time, model.Time, map[string]model.Time) { |
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.
nit: I'm not happy with the return here anymore. I think in the future we should make that a struct with proper names, this would avoid confusion.
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.
makes sense, pushed this change
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
What this PR does / why we need it:
When checking whether user specific index tables may have any expired chunks, we were using the smallest overall retention period instead of the smallest default retention period.
This causes us to unnecessarily download user index tables in some cases, for e.g:
We have a default config of
30d
,user1
has a custom stream retention of24h
anduser2
has no retention config.Here the overall smallest retention period is
24h
and the smallest default retention is30d
.When checking if
user2
's index table may have expired chunks based on table interval, we should be considering30d
retention and not24h
.Checklist