From c2fd1bda79050dec80ff2493d878a1381da592f6 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 2 Sep 2021 17:58:58 -0400 Subject: [PATCH] rgw: RGWRemoteBucketManager constructor takes num_shards The logic for getting it was moved to its caller. Signed-off-by: Adam C. Emerson --- src/rgw/rgw_data_sync.cc | 35 +++++++++++++++++++++-------------- src/rgw/rgw_data_sync.h | 9 +++++---- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 1a51c3394a6..172edef2a6f 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2798,6 +2798,7 @@ RGWRemoteBucketManager::RGWRemoteBucketManager(const DoutPrefixProvider *_dpp, const rgw_zone_id& _source_zone, RGWRESTConn *_conn, const RGWBucketInfo& source_bucket_info, + const int num_shards, const rgw_bucket& dest_bucket) : dpp(_dpp), sync_env(_sync_env), conn(_conn), source_zone(_source_zone), full_status_obj(sync_env->svc->zone->get_zone_params().log_pool, @@ -2806,23 +2807,15 @@ RGWRemoteBucketManager::RGWRemoteBucketManager(const DoutPrefixProvider *_dpp, dest_bucket)), source_bucket_info(source_bucket_info) { - rgw_bucket_index_marker_info remote_info; - BucketIndexShardsManager remote_markers; - rgw_read_remote_bilog_info(dpp, conn, source_bucket_info.bucket, - remote_info, remote_markers, null_yield); - int num_shards = remote_markers.get().size(); - sync_pairs.resize(num_shards); - int cur_shard = std::min(source_bucket_info.layout.current_index.layout.normal.num_shards, 0); - - for (int i = 0; i < num_shards; ++i, ++cur_shard) { - auto& sync_pair = sync_pairs[i]; + for (int cur_shard = 0; cur_shard < num_shards; ++cur_shard) { + auto& sync_pair = sync_pairs[cur_shard]; sync_pair.source_bs.bucket = source_bucket_info.bucket; sync_pair.dest_bucket = dest_bucket; - sync_pair.source_bs.shard_id = (source_bucket_info.layout.current_index.layout.normal.num_shards > 0 ? cur_shard : -1); + sync_pair.source_bs.shard_id = cur_shard; } sc.init(sync_env, conn, source_zone); @@ -5500,10 +5493,24 @@ int RGWBucketPipeSyncStatusManager::init(const DoutPrefixProvider *dpp) last_zone = szone; } + rgw_bucket_index_marker_info remote_info; + BucketIndexShardsManager remote_markers; + auto r = rgw_read_remote_bilog_info(dpp, conn, pipe.source.get_bucket_info().bucket, + remote_info, remote_markers, + null_yield); + + if (r < 0) { + ldpp_dout(dpp, 0) << __PRETTY_FUNCTION__ << ":" << __LINE__ + << " rgw_read_remote_bilog_info: r=" + << r << dendl; + return r; + } + const int num_shards = remote_markers.get().size(); source_mgrs.push_back(new RGWRemoteBucketManager(this, &sync_env, - szone, conn, - pipe.source.get_bucket_info(), - pipe.target.get_bucket())); + szone, conn, + pipe.source.get_bucket_info(), + num_shards, + pipe.target.get_bucket())); } return 0; diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 7c2abed736a..88c0db42f60 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -682,10 +682,11 @@ class RGWRemoteBucketManager { public: RGWRemoteBucketManager(const DoutPrefixProvider *_dpp, - RGWDataSyncEnv *_sync_env, - const rgw_zone_id& _source_zone, RGWRESTConn *_conn, - const RGWBucketInfo& source_bucket_info, - const rgw_bucket& dest_bucket); + RGWDataSyncEnv *_sync_env, + const rgw_zone_id& _source_zone, RGWRESTConn *_conn, + const RGWBucketInfo& source_bucket_info, + const int num_shards, + const rgw_bucket& dest_bucket); RGWCoroutine *read_sync_status_cr(int num, rgw_bucket_shard_sync_info *sync_status); RGWCoroutine *init_sync_status_cr(RGWObjVersionTracker& objv_tracker, rgw_bucket_index_marker_info& info); -- 2.39.5