clientv3: remove v3.WithFirstKey() in Barrier.Wait()#16156
Merged
ahrtr merged 1 commit intoetcd-io:mainfrom Jul 6, 2023
Merged
clientv3: remove v3.WithFirstKey() in Barrier.Wait()#16156ahrtr merged 1 commit intoetcd-io:mainfrom
ahrtr merged 1 commit intoetcd-io:mainfrom
Conversation
chaochn47
reviewed
Jun 30, 2023
Member
chaochn47
left a comment
There was a problem hiding this comment.
The barrier only expects one key is locked. So the change makes sense to me.
// WithFirstKey gets the lexically first key in the request range.
func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) }
// withTop gets the first key over the get's prefix given a sort order
func withTop(target SortTarget, order SortOrder) []OpOption {
return []OpOption{WithPrefix(), WithSort(target, order), WithLimit(1)}
}
Could you add a test in https://github.com/etcd-io/etcd/blob/main/tests/integration/clientv3/experimental/recipes/v3_barrier_test.go?
Contributor
Author
added, please help to review. |
chaochn47
approved these changes
Jul 1, 2023
Member
|
/cc @ahrtr @serathius to start the CI test |
ahrtr
reviewed
Jul 4, 2023
Member
|
Overall looks good to me. Please resolve the minor comment above, and also squash the commits. |
fix the unexpected blocking when using Barrier.Wait(), e.g. NewBarrier(client, "a").Wait() will block if key "a" is not existed but "a0" is existed, but it should return immediately. Signed-off-by: zhangwenkang <zwenkang@vmware.com>
Contributor
Author
done |
ahrtr
reviewed
Jul 4, 2023
ahrtr
approved these changes
Jul 4, 2023
Member
|
@kensou97 can you please backport this PR to 3.5? |
Contributor
Author
Closed
This file contains hidden or 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
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.
fix the unexpected blocking when using Barrier.Wait(), e.g. NewBarrier(client, "a").Wait() will block if key "a" is not existed but "a0" is existed, but it should return immediately.