From 3acbd3011b8354a1f800cbbc78190797bad79be3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 Nov 2020 10:21:28 +0300 Subject: [PATCH] =?UTF-8?q?[#218]=20blobovnicza:=20=D0=A1reate=20at=20leas?= =?UTF-8?q?t=20one=20range=20bucket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobovnicza/iterate.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/local_object_storage/blobovnicza/iterate.go b/pkg/local_object_storage/blobovnicza/iterate.go index cf06282e54..18da2132c4 100644 --- a/pkg/local_object_storage/blobovnicza/iterate.go +++ b/pkg/local_object_storage/blobovnicza/iterate.go @@ -26,7 +26,7 @@ func (b *Blobovnicza) iterateBucketKeys(f func(uint64, uint64, []byte) (bool, er } func (b *Blobovnicza) iterateBounds(f func(uint64, uint64) (bool, error)) error { - for upper := firstBucketBound; upper <= b.objSizeLimit; upper *= 2 { + for upper := firstBucketBound; upper <= max(b.objSizeLimit, firstBucketBound); upper *= 2 { var lower uint64 if upper == firstBucketBound { @@ -44,3 +44,11 @@ func (b *Blobovnicza) iterateBounds(f func(uint64, uint64) (bool, error)) error return nil } + +func max(a, b uint64) uint64 { + if a > b { + return a + } + + return b +}