Skip to content

Commit

Permalink
peapod: Expect root bucket presence on batch initialization
Browse files Browse the repository at this point in the history
Root BoltDB bucket is created in `New`, so running `Peapod` should treat
its absence as internal problem and don't try to re-create the bucket in
 `beginNewBatch`.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Aug 11, 2023
1 parent fe250a1 commit f602a69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/local_object_storage/peapod/peapod.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func (x *Peapod) beginNewBatch() {
return
}

x.currentBatch.bktRoot, x.currentBatch.initErr = x.currentBatch.tx.CreateBucketIfNotExists(rootBucket)
if x.currentBatch.initErr != nil {
x.currentBatch.initErr = fmt.Errorf("create BoltDB bucket for containers: %w", x.currentBatch.initErr)
x.currentBatch.bktRoot = x.currentBatch.tx.Bucket(rootBucket)
if x.currentBatch.bktRoot == nil {
x.currentBatch.initErr = errMissingRootBucket
return
}

Expand Down

0 comments on commit f602a69

Please sign in to comment.