From 09d7e98511b6cf6cab17cb594f9005df7fda795f Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Wed, 6 Mar 2019 17:05:11 -0500 Subject: [PATCH] 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) --- src/rgw/rgw_bucket.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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(); -- 2.47.3