From c307910d7131fc290f00bb8e33876e667afb72ec Mon Sep 17 00:00:00 2001 From: "lu.shasha" Date: Tue, 27 Jun 2017 10:53:30 +0800 Subject: [PATCH] rgw: fix radosgw-admin data sync run crash If sync thread have run before, then run data sync init. sync_status is still remain in rados pool. so no matter sync_status exists or not, if state is StateInit, sync_status.sync_info.num_shards should be updated. Fixes: http://tracker.ceph.com/issues/20423 Signed-off-by: Shasha Lu --- src/rgw/rgw_data_sync.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index da4db761daa9..a7cfd5c58736 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -1463,9 +1463,7 @@ public: data_sync_module = sync_env->sync_module->get_data_handler(); - if (retcode == -ENOENT) { - sync_status.sync_info.num_shards = num_shards; - } else if (retcode < 0 && retcode != -ENOENT) { + if (retcode < 0 && retcode != -ENOENT) { ldout(sync_env->cct, 0) << "ERROR: failed to fetch sync status, retcode=" << retcode << dendl; return set_cr_error(retcode); } @@ -1473,6 +1471,7 @@ public: /* state: init status */ if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateInit) { ldout(sync_env->cct, 20) << __func__ << "(): init" << dendl; + sync_status.sync_info.num_shards = num_shards; uint64_t instance_id; get_random_bytes((char *)&instance_id, sizeof(instance_id)); yield call(new RGWInitDataSyncStatusCoroutine(sync_env, num_shards, instance_id, &sync_status)); -- 2.47.3