Skip to content
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

Improve CreateBucketIfNotExists to avoid double searching the same key #532

Merged
merged 1 commit into from
Aug 10, 2023
Merged

Improve CreateBucketIfNotExists to avoid double searching the same key #532

merged 1 commit into from
Aug 10, 2023

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Jun 27, 2023

Fix #118

Benchmark with this change:

BenchmarkBucket_CreateBucketIfNotExists-10    	     123	   9573035 ns/op	   17930 B/op	      37 allocs/op

Benchmark with old implementnation:

BenchmarkBucket_CreateBucketIfNotExists-10    	     121	  10474415 ns/op	   18147 B/op	      46 allocs/op

@cenkalti
Copy link
Member

LGTM

@ahrtr
Copy link
Member Author

ahrtr commented Jun 27, 2023

cc @tjungblu and @ptabor

@ahrtr ahrtr added this to the v1.3.8 milestone Jun 27, 2023
@ahrtr
Copy link
Member Author

ahrtr commented Jun 27, 2023

Please refer to #504 (comment) to get more details.

@tjungblu
Copy link
Contributor

nice refactor.

/lgtm (non-binding)

@ahrtr
Copy link
Member Author

ahrtr commented Jul 10, 2023

@ptabor could you take a look? This should be a safe improvement.

@ahrtr ahrtr requested a review from ptabor July 18, 2023 16:24
Benchmark with this change:
BenchmarkBucket_CreateBucketIfNotExists-10    	     123	   9573035 ns/op	   17930 B/op	      37 allocs/op

Benchmark with old implementnation:
BenchmarkBucket_CreateBucketIfNotExists-10    	     121	  10474415 ns/op	   18147 B/op	      46 allocs/op

Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr
Copy link
Member Author

ahrtr commented Aug 10, 2023

cc @fuweid to take a look as well.

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ahrtr
Copy link
Member Author

ahrtr commented Aug 10, 2023

thx all for the review

@ahrtr ahrtr merged commit 0855b96 into etcd-io:master Aug 10, 2023
@ahrtr ahrtr modified the milestones: v1.3.8, v1.4.0 Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Shouldn't CreateBucketIfNotExists() try to open the bucket first?
4 participants