rgw/multisite: fix bucket shard state init function

* make sure src/dest shard ids are the same in sync pair
* copy sync pair by value in coroutine loop

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
This commit is contained in:
Yuval Lifshitz 2021-05-14 12:27:09 +03:00 committed by Casey Bodley
parent e73eac1bbd
commit 950251f923

View File

@ -2988,7 +2988,7 @@ class CheckAllBucketShardStatusIsIncremental : public RGWShardCollectCR {
if (shard >= num_shards || status < 0 || !*result) { if (shard >= num_shards || status < 0 || !*result) {
return false; return false;
} }
sync_pair.dest_bs.shard_id = shard++; sync_pair.dest_bs.shard_id = sync_pair.source_bs.shard_id = shard++;
spawn(new CheckBucketShardStatusIsIncremental(sc, sync_pair, result), false); spawn(new CheckBucketShardStatusIsIncremental(sc, sync_pair, result), false);
return true; return true;
} }
@ -3010,7 +3010,7 @@ class CheckAllBucketShardStatusIsIncremental : public RGWShardCollectCR {
// and a loop to retry on racing writes // and a loop to retry on racing writes
class InitBucketShardStatusCR : public RGWCoroutine { class InitBucketShardStatusCR : public RGWCoroutine {
RGWDataSyncCtx* sc; RGWDataSyncCtx* sc;
const rgw_bucket_sync_pair_info& pair; rgw_bucket_sync_pair_info pair;
rgw_bucket_shard_sync_info status; rgw_bucket_shard_sync_info status;
RGWObjVersionTracker objv; RGWObjVersionTracker objv;
rgw_bucket_index_marker_info& info; rgw_bucket_index_marker_info& info;
@ -3091,7 +3091,7 @@ class InitBucketShardStatusCollectCR : public RGWShardCollectCR {
if (shard >= num_shards || status < 0) { // stop spawning on any errors if (shard >= num_shards || status < 0) { // stop spawning on any errors
return false; return false;
} }
sync_pair.dest_bs.shard_id = shard++; sync_pair.dest_bs.shard_id = sync_pair.source_bs.shard_id = shard++;
spawn(new InitBucketShardStatusCR(sc, sync_pair, info, marker_mgr), false); spawn(new InitBucketShardStatusCR(sc, sync_pair, info, marker_mgr), false);
return true; return true;
} }