From 690916f0188fc60e8734de020ae21e079c896787 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Mon, 15 Jan 2024 16:18:27 +0000 Subject: [PATCH] replace CreateBucket with CreateBucketIfNotExists Signed-off-by: Benjamin Wang --- server/storage/backend/batch_tx.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/storage/backend/batch_tx.go b/server/storage/backend/batch_tx.go index c62d2af86e9..0d63f558449 100644 --- a/server/storage/backend/batch_tx.go +++ b/server/storage/backend/batch_tx.go @@ -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),