-
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: Implement metadata API limit in stores #7652
Conversation
e061ad0
to
76a3db2
Compare
fadedb9
to
d31ed17
Compare
56f8311
to
d4cea97
Compare
d4cea97
to
341d5d3
Compare
@@ -1945,8 +1958,13 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq | |||
return nil, status.Error(codes.Unknown, errors.Wrap(err, "marshal label names response hints").Error()) | |||
} | |||
|
|||
names := strutil.MergeSlices(sets...) |
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.
Do we think it is worth it to pass limit into strutil.MergeSlices
and truncate there?
func MergeSlices(a ...[]string) []string {
if len(a) == 0 {
return nil
}
if len(a) == 1 {
return a[0]
}
l := len(a) / 2
return mergeTwoStringSlices(MergeSlices(a[:l]...), MergeSlices(a[l:]...))
}
For example, if the limit is < len(a) / 2, we can skip merging the second half of slice.
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.
But this is not a blocker, we can do it in further prs
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.
Thanks Ben. I can look into it. Since this PR has gotten too big, I prefer to do in a follow up PR. :)
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
341d5d3
to
44b5b9c
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!
Can we add acceptance tests in a followup PR? Just to make sure that all store implementations support this |
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.
Thanks! This looks good. Agree with @MichaHoffmann that we need to update acceptance test in next pr.
* Store: Implement metadata API limit in stores Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com> * Apply seriesLimit in nextBatch Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com> --------- Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
Changes
This PR is part of #7575 and implements the metadata API limit in stores.
Verification