From 57023252c555f245946aca01ba7cbcf87f83a6fc Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 19 Aug 2021 16:12:21 -0400 Subject: [PATCH] rgw: rgw_read_bucket_inc_sync_status doesn't need bucket info all we need to construct the per-shard bucket sync status object names are the bucket names themselves, which we already have from rgw_sync_bucket_pipe Signed-off-by: Casey Bodley --- src/rgw/rgw_admin.cc | 2 +- src/rgw/rgw_data_sync.cc | 42 +++++++--------------------------- src/rgw/rgw_data_sync.h | 2 -- src/rgw/rgw_rest_log.cc | 4 +--- src/rgw/rgw_sync_checkpoint.cc | 8 +++---- 5 files changed, 14 insertions(+), 44 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 836ad3dbb5d22..017751ecd52ac 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2538,7 +2538,7 @@ static int bucket_source_sync_status(const DoutPrefixProvider *dpp, rgw::sal::Ra std::vector status; status.resize(full_status.shards_done_with_gen.size()); - r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info, &source_bucket->get_info(), full_status.incremental_gen, &status); + r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, full_status.incremental_gen, &status); if (r < 0) { lderr(store->ctx()) << "failed to read bucket incremental sync status: " << cpp_strerror(r) << dendl; return r; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index b225d2e7b0a06..f47f3e739e2db 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -5710,19 +5710,13 @@ class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR { } public: RGWCollectBucketSyncStatusCR(rgw::sal::RadosStore* store, RGWDataSyncCtx *sc, - const RGWBucketInfo& source_bucket_info, - const RGWBucketInfo& dest_bucket_info, + const rgw_bucket_sync_pair_info& sync_pair, uint64_t gen, Vector *status) : RGWShardCollectCR(sc->cct, max_concurrent_shards), - store(store), sc(sc), env(sc->env), gen(gen), + store(store), sc(sc), env(sc->env), gen(gen), sync_pair(sync_pair), i(status->begin()), end(status->end()) - { - // This function doesn't need to know the remote shard count, but - // callers of read_bucket_inc_sync_status do - sync_pair.source_bs = rgw_bucket_shard(source_bucket_info.bucket, 0); - sync_pair.dest_bucket = dest_bucket_info.bucket; - } + {} bool spawn_next() override { if (i == end) { @@ -5769,8 +5763,6 @@ int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp, int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp, rgw::sal::RadosStore *store, const rgw_sync_bucket_pipe& pipe, - const RGWBucketInfo& dest_bucket_info, - const RGWBucketInfo *psource_bucket_info, uint64_t gen, std::vector *status) { @@ -5781,27 +5773,10 @@ int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp, return -EINVAL; } - if (*pipe.dest.bucket != - dest_bucket_info.bucket) { - return -EINVAL; - } - - const rgw_bucket& source_bucket = *pipe.source.bucket; - - RGWBucketInfo source_bucket_info; - - if (!psource_bucket_info) { - auto& bucket_ctl = store->getRados()->ctl.bucket; - - int ret = bucket_ctl->read_bucket_info(source_bucket, &source_bucket_info, null_yield, dpp); - if (ret < 0) { - ldpp_dout(dpp, 0) << "ERROR: failed to get bucket instance info: bucket=" << source_bucket << ": " << cpp_strerror(-ret) << dendl; - return ret; - } - - psource_bucket_info = &source_bucket_info; - } - + rgw_bucket_sync_pair_info sync_pair; + sync_pair.source_bs.bucket = *pipe.source.bucket; + sync_pair.source_bs.shard_id = 0; + sync_pair.dest_bucket = *pipe.dest.bucket; RGWDataSyncEnv env; RGWSyncModuleInstanceRef module; // null sync module @@ -5813,8 +5788,7 @@ int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp, RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry()); return crs.run(dpp, new RGWCollectBucketSyncStatusCR(store, &sc, - *psource_bucket_info, - dest_bucket_info, + sync_pair, gen, status)); } diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 88c0db42f605d..bc0063e9e0fe1 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -779,8 +779,6 @@ int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp, int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp, rgw::sal::RadosStore *store, const rgw_sync_bucket_pipe& pipe, - const RGWBucketInfo& dest_bucket_info, - const RGWBucketInfo *psource_bucket_info, uint64_t gen, std::vector *status); diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index f138c9e77b525..9c6ec608b8d2f 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -1012,8 +1012,6 @@ void RGWOp_BILog_Status::execute(optional_yield y) this, static_cast(store), pipe, - bucket->get_info(), - nullptr, status.sync_status.incremental_gen, &status.inc_status); if (op_ret < 0) { @@ -1076,7 +1074,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) current_status.resize(status.sync_status.shards_done_with_gen.size()); int r = rgw_read_bucket_inc_sync_status(this, static_cast(store), - pipe, *pinfo, &bucket->get_info(), status.sync_status.incremental_gen, ¤t_status); + pipe, status.sync_status.incremental_gen, ¤t_status); if (r < 0) { ldpp_dout(this, -1) << "ERROR: rgw_read_bucket_inc_sync_status() on pipe=" << pipe << " returned ret=" << r << dendl; op_ret = r; diff --git a/src/rgw/rgw_sync_checkpoint.cc b/src/rgw/rgw_sync_checkpoint.cc index b07cec1a05a00..99bdddb6183fc 100644 --- a/src/rgw/rgw_sync_checkpoint.cc +++ b/src/rgw/rgw_sync_checkpoint.cc @@ -144,8 +144,8 @@ int bucket_source_sync_checkpoint(const DoutPrefixProvider* dpp, std::vector status; status.resize(std::max(1, num_shards)); - r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info, - &source_bucket_info, full_status.incremental_gen, &status); + r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, + full_status.incremental_gen, &status); if (r < 0) { return r; } @@ -160,8 +160,8 @@ int bucket_source_sync_checkpoint(const DoutPrefixProvider* dpp, << " local status: " << status << '\n' << " remote markers: " << remote_markers << dendl; std::this_thread::sleep_until(delay_until); - r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info, - &source_bucket_info, full_status.incremental_gen, &status); + r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, + full_status.incremental_gen, &status); if (r < 0) { return r; } -- 2.39.5