From: J. Eric Ivancich Date: Thu, 4 Jun 2020 16:41:06 +0000 (-0400) Subject: rgw: bucket list/stats truncates for user w/ >1000 buckets X-Git-Tag: v16.1.0~2119^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=11ab7c8234daa3d4c077710ea4c8b0437e57daf8;p=ceph.git rgw: bucket list/stats truncates for user w/ >1000 buckets The is_truncated flag was not being handled properly and therefore limited the output on these radosgw-admin commands to 1000 buckets. Fixes: https://tracker.ceph.com/issues/45630 Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index d94d22a3ef0d..ed04c867cdc6 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1604,9 +1604,9 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState rgw::sal::RGWBucketList buckets; rgw::sal::RGWRadosUser user(store, op_state.get_user_id()); string marker; - bool is_truncated = false; do { + buckets.clear(); ret = user.list_buckets(marker, string(), max_entries, false, buckets); if (ret < 0) return ret; @@ -1629,7 +1629,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState } flusher.flush(); - } while (is_truncated); + } while (buckets.is_truncated()); formatter->close_section(); } else if (!bucket_name.empty()) { diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 356cbefebb6e..542844d03924 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -154,8 +154,8 @@ public: buckets[bucket->ent.bucket.name] = bucket; } size_t count() const { return buckets.size(); } - -}; + void clear() { buckets.clear(); truncated = false; } +}; // class RGWBucketList class RGWObject { protected: