From: lvshanchun Date: Mon, 8 Jan 2018 03:39:20 +0000 (+0000) Subject: rgw: display data sync recovering shards in radosgw-admin sync status X-Git-Tag: v13.0.2~261^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c3ea263b910db99dfe7e7aa5f17193941c70d1d;p=ceph.git rgw: display data sync recovering shards in radosgw-admin sync status Signed-off-by: lvshanchun --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index b5dda912ace7..92de590a4f8c 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2084,6 +2084,13 @@ static void get_data_sync_status(const string& source_zone, list& status return; } + set recovering_shards; + ret = sync.read_recovering_shards(sync_status.sync_info.num_shards, recovering_shards); + if (ret < 0 && ret != ENOENT) { + push_ss(ss, status, tab) << string("failed read recovering shards: ") + cpp_strerror(-ret); + return; + } + string status_str; switch (sync_status.sync_info.state) { case rgw_data_sync_info::StateInit: @@ -2169,9 +2176,10 @@ static void get_data_sync_status(const string& source_zone, list& status } int total_behind = shards_behind.size() + (sync_status.sync_info.num_shards - num_inc); - if (total_behind == 0) { + int total_recovering = recovering_shards.size(); + if (total_behind == 0 && total_recovering == 0) { push_ss(ss, status, tab) << "data is caught up with source"; - } else { + } else if (total_behind > 0) { push_ss(ss, status, tab) << "data is behind on " << total_behind << " shards"; push_ss(ss, status, tab) << "behind shards: " << "[" << shards_behind_set << "]" ; @@ -2201,6 +2209,11 @@ static void get_data_sync_status(const string& source_zone, list& status } } + if (total_recovering > 0) { + push_ss(ss, status, tab) << total_recovering << " shards are recovering"; + push_ss(ss, status, tab) << "recovering shards: " << "[" << recovering_shards << "]"; + } + flush_ss(ss, status); }