-
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
Store/Receivers: Calculating chunk hashes on stores/receivers #5703
Store/Receivers: Calculating chunk hashes on stores/receivers #5703
Conversation
459a21f
to
dcd040c
Compare
a296efe
to
fa799bd
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.
Looks good! Just one nit - I would remove request field - I think we want to always offload hash to stores.
pkg/store/storepb/rpc.proto
Outdated
@@ -122,6 +122,9 @@ message SeriesRequest { | |||
// shard_info is used by the querier to request a specific | |||
// shard of blocks instead of entire blocks. | |||
ShardInfo shard_info = 13; | |||
|
|||
// Control whether the store should calculate the checksum/hash of chunks | |||
bool calculate_chunk_checksums = 14; |
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.
Should we remove this and control that in the implementations (each server option for all requests). I don't see a need for request to ask for it explicitly 🤔
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.
On the Thanos side I think we can always enable it. But Cortex also relies on the store gateway and the store API . Calculating hash on the cortex side is unnecessary for now
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.
Please let me know what is best here. :)
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 think it's fine to have it as a command-line argument instead of adding it to the request itself. That's what @bwplotka had in mind I believe.
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.
Umm yeah, sounds like a flag on store gateway is better
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.
If I got this right, we would need still to let them pass an option here: https://github.com/cortexproject/cortex/blob/d4fceb1172fff9ac332e525086d07f2ef182aefc/pkg/storegateway/bucket_stores.go#L484, right? Should I create a field on the bucket store to set wether or not to calculate hashes? Then, they could write a BucketStoreOption
func that allows them to set this field. Let me know if this is okay.
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.
Sorry for the late reply. For me I think it is fine to add it at blockSeries
to control that option. Do you think it works?
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 did that, I just thought that since that is a private function of the package they were not able to call it themselves.
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.
Ah you are right sorry. So we need either:
- an option at BucketStore to turn on/off chunk hashing
- modify series request
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.
Can you please recheck @yeya24 , I went with my idea to create a BucketStoreOption
and enabled it by default on thanos side.
a4a2a51
to
2701f11
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
pkg/store/storepb/rpc.proto
Outdated
@@ -122,6 +122,9 @@ message SeriesRequest { | |||
// shard_info is used by the querier to request a specific | |||
// shard of blocks instead of entire blocks. | |||
ShardInfo shard_info = 13; | |||
|
|||
// Control whether the store should calculate the checksum/hash of chunks | |||
bool calculate_chunk_checksums = 14; |
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.
If we don't need to change the protobuf file, then seems it is also okay to not add any flags.
Since Cortex only shares the store gateway with Thanos, so as long as the blockSeries
method exposes a boolean param to control not calculate hash then it is fine. On the thanos side, we can make it always true
.
b82dbed
to
c4eb864
Compare
0d19ff2
to
94be3bf
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
43502e8
to
83ee0ab
Compare
@pedro-stanaka can you push an empty commit please to retrigger the CI? I think something happened to Github Actions and they didn't run after your last push. |
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
…ashes Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> fixing flaky e2e tests Signed-off-by: Pedro Tanaka <pedro.tanaka@legal.one> fix integration test for prometheus Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Final fix on error linting Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
83ee0ab
to
2055036
Compare
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
Hey Douglas. Thanks for taking a look at this. I rebased and fixed some errors regarding new code from main, should be fine now. |
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
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.
This looks good. Should we merge 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.
LGTM
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.
Now we need to start using this here ;P
…-io#5703) * Adding hashes to raw chunks and populating it from bucket store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding flag on SeriesRequest to control whether to calculate or not hashes Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Only calculate hash on series request for bucket when needed Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * implement e2e test for prometheus store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> fixing flaky e2e tests Signed-off-by: Pedro Tanaka <pedro.tanaka@legal.one> fix integration test for prometheus Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * calculating hash on TSDB Series() request as well Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Final fix on error linting Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using sync.Pool to avoid gc pressure Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing whitespace Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing nit on proto Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing hashpool Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using pool from callee instead of inside helper function Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Reusing the hasher pool in other places Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Calculating hashes by default Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adjusting e2e and integration tests Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * fixing linting and e2e test Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Fixing new call format for tsdb.NewHead Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding option to control whether to hash chunks on stores or not Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
…-io#5703) * Adding hashes to raw chunks and populating it from bucket store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding flag on SeriesRequest to control whether to calculate or not hashes Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Only calculate hash on series request for bucket when needed Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * implement e2e test for prometheus store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> fixing flaky e2e tests Signed-off-by: Pedro Tanaka <pedro.tanaka@legal.one> fix integration test for prometheus Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * calculating hash on TSDB Series() request as well Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Final fix on error linting Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using sync.Pool to avoid gc pressure Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing whitespace Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing nit on proto Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing hashpool Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using pool from callee instead of inside helper function Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Reusing the hasher pool in other places Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Calculating hashes by default Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adjusting e2e and integration tests Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * fixing linting and e2e test Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Fixing new call format for tsdb.NewHead Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding option to control whether to hash chunks on stores or not Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
…-io#5703) * Adding hashes to raw chunks and populating it from bucket store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding flag on SeriesRequest to control whether to calculate or not hashes Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Only calculate hash on series request for bucket when needed Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * implement e2e test for prometheus store Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> fixing flaky e2e tests Signed-off-by: Pedro Tanaka <pedro.tanaka@legal.one> fix integration test for prometheus Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * calculating hash on TSDB Series() request as well Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Final fix on error linting Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using sync.Pool to avoid gc pressure Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing whitespace Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing nit on proto Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Fixing hashpool Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Using pool from callee instead of inside helper function Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Reusing the hasher pool in other places Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Calculating hashes by default Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adjusting e2e and integration tests Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * fixing linting and e2e test Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Fixing new call format for tsdb.NewHead Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> * Adding option to control whether to hash chunks on stores or not Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com> Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Related to #5682
Changes
Series()
in store to pre-calculate hashes for faster deduplication on querier:Verification