From 934d4db2f0e3d5b919c77cb1bacfef2f7d9feb7e Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Wed, 4 Sep 2019 10:02:32 -0400 Subject: [PATCH] rgw: fix minimum of unordered bucket listing A recent PR made sure that a bucket listing could not request too many entries at once. It also did a minimum computation for number of entries. For ordered listing the minimum was 0, as required to pass all unit tests. However the minimum for unordered listing was left at 1. In order to make ordered and unordered listing behave the same -- with the exception of ordering -- the minimum for unordered listing is modified to 0. Signed-off-by: J. Eric Ivancich (manually cherry picked from 38e02a7157d4c534cc9fd8ccfe20fdd93a9b07a8) Conflicts: src/srgw/rgw_rados.cc - automated cherry-pick from master failed strangely: made the changes manually --- src/rgw/rgw_rados.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index f2858ac1c85..43a0c1452c4 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -5656,7 +5656,7 @@ int RGWRados::Bucket::List::list_objects_ordered(int64_t max_p, int count = 0; bool truncated = true; - const int64_t max = // protect against memory issues and non-positive vals + const int64_t max = // protect against memory issues and negative vals std::min(bucket_list_objects_absolute_max, std::max(int64_t(0), max_p)); int read_ahead = std::max(cct->_conf->rgw_list_bucket_min_readahead, max); @@ -5843,8 +5843,8 @@ int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p, int count = 0; bool truncated = true; - const int64_t max = // protect against memory issues and non-positive vals - std::min(bucket_list_objects_absolute_max, std::max(int64_t(1), max_p)); + const int64_t max = // protect against memory issues and negative vals + std::min(bucket_list_objects_absolute_max, std::max(int64_t(0), max_p)); // read a few extra in each call to cls_bucket_list_unordered in // case some are filtered out due to namespace matching, versioning, -- 2.47.3