-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add memcached support to index cache #1881
Merged
bwplotka
merged 34 commits into
thanos-io:master
from
pracucci:add-memcached-support-to-index-cache
Jan 3, 2020
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
cc101b8
Moved index cache key struct outside of the file containing the in-me…
pracucci ba6af3d
Added cacheKey.string() to make it memcached friendly
pracucci 0f57c95
Added MemcachedIndexCache support
pracucci aaa15f4
Export Prometheus metrics from MemcachedIndexCache
pracucci 60b23d4
Fixed linter issues
pracucci b114623
Simplified workers wait group in memcachedClient
pracucci 4afe30a
Fixed memcached client GetMulti() results batches channel buffer
pracucci bcc5ceb
Wait for addrs resolution gorouting to complete on memcachedClient.St…
pracucci ebd9af0
Return struct from NewMemcachedClient()
pracucci 4581111
Update pkg/cacheutil/memcached_client.go
pracucci c9d37f9
Simplified memcachedClient tests
pracucci 77413ca
Cleaned up code based on feedback
pracucci 16d368a
Removed error from GetMulti() return and introduced metrics and traci…
pracucci 9178cdd
Fixed compilation errors in store E2E tests
pracucci 8951227
Added leaktest check to all tests
pracucci 390e93c
Introduced --index.cache-config support
pracucci 702dc82
Fixed compilation errors in store E2E tests
pracucci bf5dd7c
Updated store flags doc
pracucci fb6d122
Updated index cache doc
pracucci a7c20f2
Updated changelog
pracucci e2c72a0
Increased default memcached client timeout from 100ms to 500ms
pracucci f8b318e
Disabled memcached client max batch size by default
pracucci 491c5bb
Fixed index cache key max length
pracucci db9356b
Removed TODO from memcached client since looks the general consensus …
pracucci bb3eb88
Allow to configure in-memory index cache using byte units
pracucci 1ea97b2
Refactored index cache config file doc
pracucci 08f1bd3
Fixed nits in comments
pracucci f83b2d2
Replaced hardcoded 16 with ULID calculated length based on review com…
pracucci b8b8517
Do not expose jumpHash func
pracucci f62a0b4
Updated changelog
pracucci b2d822e
Switched MemcachedClient GetMulti() concurrency limit to a gate
pracucci 9113f0c
Fixed flaky tests
pracucci da13b4b
Fixed typos in comments
pracucci f1482f2
Renamed memcached config option addrs to addresses
pracucci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cacheutil | ||
|
||
// jumpHash consistently chooses a hash bucket number in the range | ||
// [0, numBuckets) for the given key. numBuckets must be >= 1. | ||
// | ||
// Copied from github.com/dgryski/go-jump/blob/master/jump.go (MIT license). | ||
func jumpHash(key uint64, numBuckets int) int32 { | ||
var b int64 = -1 | ||
var j int64 | ||
|
||
for j < int64(numBuckets) { | ||
b = j | ||
key = key*2862933555777941757 + 1 | ||
j = int64(float64(b+1) * (float64(int64(1)<<31) / float64((key>>33)+1))) | ||
} | ||
|
||
return int32(b) | ||
} |
Oops, something went wrong.
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.
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.
👍