From a7685f50c92c54f23c8156eb2297e4b65a3aec9f Mon Sep 17 00:00:00 2001 From: Kaloyan Raev Date: Thu, 3 Dec 2020 13:07:27 +0200 Subject: [PATCH] satellite/metainfo/metabase: set maxParts to MaxListLimit if greater We should set the client requested maxParts to MaxListLimit if it is greater than that value instead of returning an error. MinIO default value for maxParts is 10,000 while the satellite's MaxListLimit is 1,000. If we return an error, the ListParts with default maxParts will throw an error. Change-Id: I06739e1d8d8f96803eba491585395da0443aec04 --- satellite/metainfo/metabase/list_segments.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/satellite/metainfo/metabase/list_segments.go b/satellite/metainfo/metabase/list_segments.go index e8fd9efe3..aeae4eacf 100644 --- a/satellite/metainfo/metabase/list_segments.go +++ b/satellite/metainfo/metabase/list_segments.go @@ -33,15 +33,11 @@ func (db *DB) ListSegments(ctx context.Context, opts ListSegments) (result ListS return ListSegmentsResult{}, ErrInvalidRequest.New("StreamID missing") } - // TODO verify this limit - if opts.Limit > MaxListLimit { - return ListSegmentsResult{}, ErrInvalidRequest.New("Maximum listing limit is %d", MaxListLimit) - } if opts.Limit < 0 { return ListSegmentsResult{}, ErrInvalidRequest.New("Invalid limit: %d", opts.Limit) } - if opts.Limit == 0 { + if opts.Limit == 0 || opts.Limit > MaxListLimit { opts.Limit = MaxListLimit }