From: Casey Bodley Date: Mon, 30 Apr 2018 15:42:46 +0000 (-0400) Subject: rgw: rgw_bucket_sync_status takes bucket info X-Git-Tag: v12.2.6~131^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e895be2ccfc014f72f3c8596f7569aa6efa0005d;p=ceph.git rgw: rgw_bucket_sync_status takes bucket info 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 (cherry picked from commit 3640ee844a9d77f0fa6a6849c4d8b51cc932f4e2) --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index e4f37267e1c8d..1d4dc7a3a9602 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -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 *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(1, info.num_shards)); + status->resize(std::max(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)); } diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 0d0c14f368672..9af1d4bb64f6c 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -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 *status); class RGWDefaultSyncModule : public RGWSyncModule { diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 47d4e3e7a8141..6824fd791ba7b 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -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()