]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: use negative shard id when creating sync pair
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 27 Nov 2019 00:11:29 +0000 (16:11 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:39 +0000 (10:20 -0800)
negative shard id means the bucket has a single shard. This
is to be backward compatible.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc

index 3ee7271e076fad712d3f4b226e98519f1e1e9bf6..a029c090d638ea4277fd24b7b892aa30b7d23dae 100644 (file)
@@ -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;
         }