From: Yehuda Sadeh Date: Thu, 23 Jan 2020 01:16:53 +0000 (-0800) Subject: rgw: bucket sync: get_hint_entities(), call read_bucket_info once X-Git-Tag: v15.1.0~22^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ed95206e22bb2e6d45fb939459bfebb5147e6dca;p=ceph.git rgw: bucket sync: get_hint_entities(), call read_bucket_info once once per bucket Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/services/svc_bucket_sync_sobj.cc b/src/rgw/services/svc_bucket_sync_sobj.cc index 005f09170a28..c9629a2a3132 100644 --- a/src/rgw/services/svc_bucket_sync_sobj.cc +++ b/src/rgw/services/svc_bucket_sync_sobj.cc @@ -73,18 +73,26 @@ void RGWSI_Bucket_Sync_SObj::get_hint_entities(RGWSI_Bucket_X_Ctx& ctx, std::set *hint_entities, optional_yield y) { - for (auto& zone : zones) { - for (auto& b : buckets) { - RGWBucketInfo hint_bucket_info; - int ret = svc.bucket_sobj->read_bucket_info(ctx, b, &hint_bucket_info, - nullptr, nullptr, boost::none, - y); - if (ret < 0) { - ldout(cct, 20) << "could not init bucket info for hint bucket=" << b << " ... skipping" << dendl; - continue; - } + vector hint_buckets; + + hint_buckets.reserve(buckets.size()); - hint_entities->insert(rgw_sync_bucket_entity(zone, hint_bucket_info.bucket)); + for (auto& b : buckets) { + RGWBucketInfo hint_bucket_info; + int ret = svc.bucket_sobj->read_bucket_info(ctx, b, &hint_bucket_info, + nullptr, nullptr, boost::none, + y); + if (ret < 0) { + ldout(cct, 20) << "could not init bucket info for hint bucket=" << b << " ... skipping" << dendl; + continue; + } + + hint_buckets.emplace_back(std::move(hint_bucket_info.bucket)); + } + + for (auto& zone : zones) { + for (auto& b : hint_buckets) { + hint_entities->insert(rgw_sync_bucket_entity(zone, b)); } } }