From 950251f923a55818e33d5dfdb7fea589495404f7 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Fri, 14 May 2021 12:27:09 +0300 Subject: [PATCH] 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 --- src/rgw/rgw_data_sync.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index e04260212fd..c70b70cd056 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2988,7 +2988,7 @@ class CheckAllBucketShardStatusIsIncremental : public RGWShardCollectCR { if (shard >= num_shards || status < 0 || !*result) { 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); return true; } @@ -3010,7 +3010,7 @@ class CheckAllBucketShardStatusIsIncremental : public RGWShardCollectCR { // and a loop to retry on racing writes class InitBucketShardStatusCR : public RGWCoroutine { RGWDataSyncCtx* sc; - const rgw_bucket_sync_pair_info& pair; + rgw_bucket_sync_pair_info pair; rgw_bucket_shard_sync_info status; RGWObjVersionTracker objv; 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 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); return true; }