Skip to content

Commit

Permalink
Merge pull request etcd-io#17249 from ahrtr/meta_bucket_20240115
Browse files Browse the repository at this point in the history
Replace `CreateBucket` with `CreateBucketIfNotExists`
  • Loading branch information
ahrtr authored Jan 16, 2024
2 parents 4bc55e5 + 690916f commit e3c70c8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/storage/backend/batch_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ func (t *batchTx) Unlock() {
}

func (t *batchTx) UnsafeCreateBucket(bucket Bucket) {
_, err := t.tx.CreateBucket(bucket.Name())
if err != nil && err != bolt.ErrBucketExists {
if _, err := t.tx.CreateBucketIfNotExists(bucket.Name()); err != nil {
t.backend.lg.Fatal(
"failed to create a bucket",
zap.Stringer("bucket-name", bucket),
Expand Down

0 comments on commit e3c70c8

Please sign in to comment.