From: Matt Benjamin Date: Wed, 6 Mar 2019 22:05:11 +0000 (-0500) Subject: rgw: bucket limit check misbehaves for > max-entries buckets (usually 1000) X-Git-Tag: v13.2.6~115^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26945%2Fhead;p=ceph.git rgw: bucket limit check misbehaves for > max-entries buckets (usually 1000) RGWBucketAdminOp::limit_check does not correctly handle truncation/continuation markers across calls to rgw_read_user_buckets(...). Also, it should, but does not, flush its formatter periodically. Fixes: https://tracker.ceph.com/issues/35973 Signed-off-by: Matt Benjamin (cherry picked from commit 675b775ea52e0d7b81efb32c6cffa6987190184b) --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index e688388e4323..45859827124c 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1474,14 +1474,15 @@ int RGWBucketAdminOp::limit_check(RGWRados *store, formatter->open_array_section("users"); for (const auto& user_id : user_ids) { + formatter->open_object_section("user"); formatter->dump_string("user_id", user_id); - bool done; formatter->open_array_section("buckets"); + + string marker; + bool is_truncated{false}; do { RGWUserBuckets buckets; - string marker; - bool is_truncated; ret = rgw_read_user_buckets(store, user_id, buckets, marker, string(), max_entries, false, @@ -1556,9 +1557,8 @@ int RGWBucketAdminOp::limit_check(RGWRados *store, } } } - - done = (m_buckets.size() < max_entries); - } while (!done); /* foreach: bucket */ + formatter->flush(cout); + } while (is_truncated); /* foreach: bucket */ formatter->close_section(); formatter->close_section();