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: v14.0.0~177^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3640ee844a9d77f0fa6a6849c4d8b51cc932f4e2;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 --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 606372feb0ea..cc1bbabb4f39 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -3405,18 +3405,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 @@ -3424,8 +3418,8 @@ int rgw_bucket_sync_status(RGWRados *store, const std::string& source_zone, nullptr, 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 2238fa547040..613dd9e37ac6 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -559,7 +559,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 a0510266f411..2a8668486b58 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()