-
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
boltdb shipper index list cache improvements #6054
Merged
sandeepsukhani
merged 2 commits into
grafana:main
from
sandeepsukhani:boltdb-shipper-skip-list-cache-query-time-index-download
May 2, 2022
Merged
boltdb shipper index list cache improvements #6054
sandeepsukhani
merged 2 commits into
grafana:main
from
sandeepsukhani:boltdb-shipper-skip-list-cache-query-time-index-download
May 2, 2022
Conversation
This file contains 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
1 task
cyriltovena
approved these changes
May 2, 2022
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
grafanabot
pushed a commit
that referenced
this pull request
May 3, 2022
* bypass index list cache when doing query time downloading of index * detect and refresh stale index list cache during sync (cherry picked from commit 2758dc6)
trevorwhitney
pushed a commit
that referenced
this pull request
May 3, 2022
sandeepsukhani
added a commit
to sandeepsukhani/loki
that referenced
this pull request
Jun 6, 2022
1 task
sandeepsukhani
added a commit
that referenced
this pull request
Jun 6, 2022
sandeepsukhani
added a commit
that referenced
this pull request
Jun 6, 2022
sandeepsukhani
added a commit
that referenced
this pull request
Jun 6, 2022
This was referenced Jun 28, 2022
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.
What this PR does / why we need it:
To reduce the number of list calls we make to the object store when using boltdb-shipper, we have a cache in place. The cache stays valid for 1 min and is refreshed when a list call is made and it finds that cache needs to be rebuilt. The list call could take a couple of seconds to finish in a large cluster which can add up to the query latency when downloading index at query time.
This PR adds a parameter to list calls to skip the list cache and directly load the objects list from the object store. We will skip the cache only while doing query time download of index which is not too common, we see just up to 8k query time download operations in a day in our largest Loki cluster.
The other change this PR does is to detect the staleness of the list cache. Before explaining the problem, let us keep few things in mind:
Now the problem is if compaction happened just after we cached the list of objects, the sync operation on the recently compacted table would try to download old source files that were compacted away but we would just ignore missing files as mentioned above. This means we won't have downloaded either of source index files and the new compacted file, still not know too us due to stale cache. This PR adds a check in sync code to see if we skipped downloading all the files, if so then we would retry the sync after force refreshing the index list cache.
Checklist