]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw_bucket_sync_status takes bucket info
authorCasey Bodley <cbodley@redhat.com>
Mon, 30 Apr 2018 15:42:46 +0000 (11:42 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 14 May 2018 17:28:04 +0000 (13:28 -0400)
rgw_bucket_sync_status() no longer reads the bucket instance info, and
instead requires the caller to pass it in

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3640ee844a9d77f0fa6a6849c4d8b51cc932f4e2)

src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h
src/rgw/rgw_rest_log.cc

index e4f37267e1c8d763517fd9e6124189bcbdc2662f..1d4dc7a3a9602be17b0940f5b959c591c2900fec 100644 (file)
@@ -3240,18 +3240,12 @@ class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR {
 };
 
 int rgw_bucket_sync_status(RGWRados *store, const std::string& source_zone,
-                           const rgw_bucket& bucket,
+                           const RGWBucketInfo& bucket_info,
                            std::vector<rgw_bucket_shard_sync_info> *status)
 {
-  // read the bucket instance info for num_shards
-  RGWObjectCtx ctx(store);
-  RGWBucketInfo info;
-  int ret = store->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr);
-  if (ret < 0) {
-    return ret;
-  }
+  const auto num_shards = bucket_info.num_shards;
   status->clear();
-  status->resize(std::max<size_t>(1, info.num_shards));
+  status->resize(std::max<size_t>(1, num_shards));
 
   RGWDataSyncEnv env;
   RGWSyncModuleInstanceRef module; // null sync module
@@ -3259,8 +3253,8 @@ int rgw_bucket_sync_status(RGWRados *store, const std::string& source_zone,
            nullptr, nullptr, source_zone, module, nullptr);
 
   RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry());
-  return crs.run(new RGWCollectBucketSyncStatusCR(store, &env, info.num_shards,
-                                                  bucket, status));
+  return crs.run(new RGWCollectBucketSyncStatusCR(store, &env, num_shards,
+                                                  bucket_info.bucket, status));
 }
 
 
index 0d0c14f368672514bcb79dfe1f683b22d4697f78..9af1d4bb64f6cd070042fa0c5b23e5542e5fb389 100644 (file)
@@ -548,7 +548,7 @@ public:
 
 /// read the sync status of all bucket shards from the given source zone
 int rgw_bucket_sync_status(RGWRados *store, const std::string& source_zone,
-                           const rgw_bucket& bucket,
+                           const RGWBucketInfo& bucket_info,
                            std::vector<rgw_bucket_shard_sync_info> *status);
 
 class RGWDefaultSyncModule : public RGWSyncModule {
index 47d4e3e7a8141446da63082ea59f9d0249118f12..6824fd791ba7b180d5ec3f1681fd6dddbb61e8e3 100644 (file)
@@ -906,7 +906,15 @@ void RGWOp_BILog_Status::execute()
     return;
   }
 
-  http_ret = rgw_bucket_sync_status(store, source_zone, bucket, &status);
+  // read the bucket instance info for num_shards
+  RGWObjectCtx ctx(store);
+  RGWBucketInfo info;
+  http_ret = store->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr);
+  if (http_ret < 0) {
+    ldout(s->cct, 4) << "failed to read bucket info: " << cpp_strerror(http_ret) << dendl;
+    return;
+  }
+  http_ret = rgw_bucket_sync_status(store, source_zone, info, &status);
 }
 
 void RGWOp_BILog_Status::send_response()