From 04cd5921dd2077c983091458c49fcc629dc72226 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 2 Oct 2015 15:29:57 -0700 Subject: [PATCH] rgw: data sync, spawn sync on all shards full sync should work now Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_data_sync.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index c1493366e1709..66cee6bbf8ff6 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -601,7 +601,7 @@ public: return set_state(RGWCoroutine_Error, -EIO); } - bucket_instance = bucket_instance.substr(0, pos - 1); + bucket_instance = bucket_instance.substr(0, pos); } int ret = call(new RGWRunBucketSyncCoroutine(http_manager, async_rados, conn, store, obj_ctx, source_zone, bucket_name, bucket_instance, shard_id)); if (ret < 0) { @@ -880,16 +880,17 @@ public: } } } - if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateSync) { -#if 0 - case rgw_data_sync_info::StateSync: - for (int i = 0; i < num_shards; i++) { - RGWCoroutine *cr = new RGWDataSyncShardCR(store, &http_manager, async_rados, - conn, store->get_zone_params().log_pool, source_zone, - i, rgw_data_sync_marker& _marker) - } -#endif -#warning FIXME + yield { + if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateSync) { + case rgw_data_sync_info::StateSync: + for (map::iterator iter = sync_status.sync_markers.begin(); + iter != sync_status.sync_markers.end(); ++iter) { + RGWCoroutine *cr = new RGWDataSyncShardCR(store, http_manager, async_rados, + conn, store->get_zone_params().log_pool, source_zone, + iter->first, iter->second); + spawn(cr, true); + } + } } return set_state(RGWCoroutine_Done, 0); -- 2.39.5