From d9b57efaf2e62782584104f828b65cf18d30073f Mon Sep 17 00:00:00 2001 From: Ilsoo Byun Date: Tue, 7 Jan 2020 10:35:53 +0900 Subject: [PATCH] rgw: move forward marker even in case of many non-existent indexes Signed-off-by: Ilsoo Byun (cherry picked from commit 2eaac132d491ef3c6f8cb50c34fc67f56e006c07) Conflicts: src/rgw/rgw_rados.cc - manual cherry-pick --- src/rgw/rgw_rados.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index a806be7690cb3..c5fb71c566c39 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -13413,10 +13413,11 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, map updates; uint32_t count = 0; + int pos = -1; while (count < num_entries && !candidates.empty()) { r = 0; // Select the next one - int pos = candidates.begin()->second; + pos = candidates.begin()->second; const string& name = vcurrents[pos]->first; struct rgw_bucket_dir_entry& dirent = vcurrents[pos]->second; @@ -13472,8 +13473,9 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, break; } } - if (!m.empty()) - *last_entry = m.rbegin()->first; + + if (pos >= 0) + *last_entry = std::move((--vcurrents[pos])->first); return 0; } -- 2.39.5