satellite/metabase: increase maximum batch size for loop

Current default is equal to hardcoded maximum of batch size
for loop listing. With this change we will bump maximum
batch size but current default won't change. We will be able to
increase it later without need for source code change.

Change-Id: I2744a87be28af4157f58ede73455682f61733bc1
This commit is contained in:
Michał Niewrzał 2021-09-09 15:15:19 +02:00 committed by Michal Niewrzal
parent 495e530933
commit 84a383638b
2 changed files with 4 additions and 10 deletions

View File

@ -14,7 +14,7 @@ import (
"storj.io/private/tagsql"
)
const loopIteratorBatchSizeLimit = 2500
const loopIteratorBatchSizeLimit = intLimitRange(5000)
// IterateLoopObjects contains arguments necessary for listing objects in metabase.
type IterateLoopObjects struct {
@ -72,10 +72,7 @@ func (db *DB) IterateLoopObjects(ctx context.Context, opts IterateLoopObjects, f
asOfSystemInterval: opts.AsOfSystemInterval,
}
// ensure batch size is reasonable
if it.batchSize <= 0 || it.batchSize > loopIteratorBatchSizeLimit {
it.batchSize = loopIteratorBatchSizeLimit
}
loopIteratorBatchSizeLimit.Ensure(&it.batchSize)
it.curRows, err = it.doNextQuery(ctx)
if err != nil {
@ -256,10 +253,7 @@ func (db *DB) IterateLoopSegments(ctx context.Context, opts IterateLoopSegments,
cursor: loopSegmentIteratorCursor{},
}
// ensure batch size is reasonable
if it.batchSize <= 0 || it.batchSize > loopIteratorBatchSizeLimit {
it.batchSize = loopIteratorBatchSizeLimit
}
loopIteratorBatchSizeLimit.Ensure(&it.batchSize)
it.curRows, err = it.doNextQuery(ctx)
if err != nil {

View File

@ -18,7 +18,7 @@ import (
"storj.io/storj/satellite/metabase"
)
const batchsizeLimit = 2500
const batchsizeLimit = 5000
var (
mon = monkit.Package()