From cc5d3288a167271928a93e81ddf0f37ecb3ea451 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 14 Sep 2021 17:32:05 +0300 Subject: [PATCH] [#791] blobovnicza: Don't iterate over range buckets in Iterate `Blobovnicza` can be initialized with any number of range buckets, and reconstructed with different size limit. In previous implementation `Iterate` could miss some stored objects if we construct `Blobovnicza` with smaller number of ranges. Make `Iterate` to traverse all buckets regardless of current instance bounds. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobovnicza/iterate.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/local_object_storage/blobovnicza/iterate.go b/pkg/local_object_storage/blobovnicza/iterate.go index 5bcd26c6fd..9be263102f 100644 --- a/pkg/local_object_storage/blobovnicza/iterate.go +++ b/pkg/local_object_storage/blobovnicza/iterate.go @@ -116,8 +116,8 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) { var elem IterationElement if err := b.boltDB.View(func(tx *bbolt.Tx) error { - return b.iterateBuckets(tx, func(lower, upper uint64, buck *bbolt.Bucket) (bool, error) { - err := buck.ForEach(func(k, v []byte) error { + return tx.ForEach(func(name []byte, buck *bbolt.Bucket) error { + return buck.ForEach(func(k, v []byte) error { if prm.decodeAddresses { if elem.addr == nil { elem.addr = object.NewAddress() @@ -134,8 +134,6 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) { return prm.handler(elem) }) - - return err != nil, err }) }); err != nil { return nil, err