From 852568509368cdfe12086a9250d84b3f033d2794 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 4 Oct 2016 14:55:18 -0700 Subject: [PATCH] rgw: dump objects in RGWBucket::check_object_index() Fixes: http://tracker.ceph.com/issues/14589 Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_bucket.cc | 17 ++++++++++++----- src/rgw/rgw_bucket.h | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index df420ccb731b..2f62e9a840e1 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1094,7 +1094,8 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, } int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state, - map result, std::string *err_msg) + RGWFormatterFlusher& flusher, + std::string *err_msg) { bool fix_index = op_state.will_fix_index(); @@ -1115,6 +1116,8 @@ int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state, rgw_obj_key marker; bool is_truncated = true; + Formatter *formatter = flusher.get_formatter(); + formatter->open_object_section("objects"); while (is_truncated) { map result; @@ -1126,8 +1129,15 @@ int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state, } else if (r < 0 && r != -ENOENT) { set_err_msg(err_msg, "ERROR: failed operation r=" + cpp_strerror(-r)); } + + + dump_bucket_index(result, formatter); + flusher.flush(); + } + formatter->close_section(); + store->cls_obj_set_bucket_tag_timeout(bucket, 0); return 0; @@ -1325,13 +1335,10 @@ int RGWBucketAdminOp::check_index(RGWRados *store, RGWBucketAdminOpState& op_sta dump_mulipart_index_results(objs_to_unlink, formatter); flusher.flush(); - ret = bucket.check_object_index(op_state, result); + ret = bucket.check_object_index(op_state, flusher); if (ret < 0) return ret; - dump_bucket_index(result, formatter); - flusher.flush(); - ret = bucket.check_index(op_state, existing_stats, calculated_stats); if (ret < 0) return ret; diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 12182d12935a..4ded18ed521f 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -277,7 +277,8 @@ public: list& objs_to_unlink, std::string *err_msg = NULL); int check_object_index(RGWBucketAdminOpState& op_state, - map result, std::string *err_msg = NULL); + RGWFormatterFlusher& flusher, + std::string *err_msg = NULL); int check_index(RGWBucketAdminOpState& op_state, map& existing_stats, -- 2.47.3