forked from TrueCloudLab/frostfs-node
[#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 <leonard@nspcc.ru>
This commit is contained in:
parent
5e2ca0d04b
commit
cc5d3288a1
1 changed files with 2 additions and 4 deletions
|
@ -116,8 +116,8 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) {
|
||||||
var elem IterationElement
|
var elem IterationElement
|
||||||
|
|
||||||
if err := b.boltDB.View(func(tx *bbolt.Tx) error {
|
if err := b.boltDB.View(func(tx *bbolt.Tx) error {
|
||||||
return b.iterateBuckets(tx, func(lower, upper uint64, buck *bbolt.Bucket) (bool, error) {
|
return tx.ForEach(func(name []byte, buck *bbolt.Bucket) error {
|
||||||
err := buck.ForEach(func(k, v []byte) error {
|
return buck.ForEach(func(k, v []byte) error {
|
||||||
if prm.decodeAddresses {
|
if prm.decodeAddresses {
|
||||||
if elem.addr == nil {
|
if elem.addr == nil {
|
||||||
elem.addr = object.NewAddress()
|
elem.addr = object.NewAddress()
|
||||||
|
@ -134,8 +134,6 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) {
|
||||||
|
|
||||||
return prm.handler(elem)
|
return prm.handler(elem)
|
||||||
})
|
})
|
||||||
|
|
||||||
return err != nil, err
|
|
||||||
})
|
})
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue