From: Yehuda Sadeh Date: Wed, 27 Nov 2019 00:11:29 +0000 (-0800) Subject: rgw: use negative shard id when creating sync pair X-Git-Tag: v15.1.0~22^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99caf86cc7ba87bda4a8a5ae8e0f7798ebc34b81;p=ceph.git rgw: use negative shard id when creating sync pair negative shard id means the bucket has a single shard. This is to be backward compatible. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 3ee7271e076fa..a029c090d638e 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2818,7 +2818,7 @@ RGWRemoteBucketManager::RGWRemoteBucketManager(const DoutPrefixProvider *_dpp, sync_pair.source_bs.bucket = source_bucket_info.bucket; sync_pair.dest_bs.bucket = dest_bucket; - sync_pair.source_bs.shard_id = cur_shard; + sync_pair.source_bs.shard_id = (source_bucket_info.num_shards > 0 ? cur_shard : -1); if (dest_bucket == source_bucket_info.bucket) { sync_pair.dest_bs.shard_id = sync_pair.source_bs.shard_id; @@ -4307,9 +4307,9 @@ int RGWRunBucketSourcesSyncCR::operate() ldpp_dout(sync_env->dpp, 20) << __func__ << "(): num shards=" << num_shards << " cur_shard=" << cur_shard << dendl; for (; num_shards > 0; --num_shards, ++cur_shard) { - sync_pair.source_bs.shard_id = cur_shard; + sync_pair.source_bs.shard_id = (source_num_shards > 0 ? cur_shard : -1); if (source_num_shards == target_num_shards) { - sync_pair.dest_bs.shard_id = cur_shard; + sync_pair.dest_bs.shard_id = sync_pair.source_bs.shard_id; } else { sync_pair.dest_bs.shard_id = -1; }