]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dump objects in RGWBucket::check_object_index() 11324/head
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 4 Oct 2016 21:55:18 +0000 (14:55 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 4 Oct 2016 21:55:18 +0000 (14:55 -0700)
Fixes: http://tracker.ceph.com/issues/14589
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h

index df420ccb731b176a1f02c1a8d603531627b2afb7..2f62e9a840e1ea8046aca313b4c6ef032904f51e 100644 (file)
@@ -1094,7 +1094,8 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
 }
 
 int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state,
-        map<string, RGWObjEnt> 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<string, RGWObjEnt> 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;
index 12182d12935ab0828283dc3fcff54b12959ba3c7..4ded18ed521f1dca10da860285c80c0561ad5f83 100644 (file)
@@ -277,7 +277,8 @@ public:
           list<rgw_obj_key>& objs_to_unlink, std::string *err_msg = NULL);
 
   int check_object_index(RGWBucketAdminOpState& op_state,
-          map<string, RGWObjEnt> result, std::string *err_msg = NULL);
+                         RGWFormatterFlusher& flusher,
+                         std::string *err_msg = NULL);
 
   int check_index(RGWBucketAdminOpState& op_state,
           map<RGWObjCategory, RGWStorageStats>& existing_stats,