]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: display data sync recovering shards in radosgw-admin sync status
authorlvshanchun <lvshanchun@gmail.com>
Mon, 8 Jan 2018 03:39:20 +0000 (03:39 +0000)
committerCasey Bodley <cbodley@redhat.com>
Wed, 9 May 2018 17:04:54 +0000 (13:04 -0400)
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
(cherry picked from commit 8c3ea263b910db99dfe7e7aa5f17193941c70d1d)

src/rgw/rgw_admin.cc

index 493a010674e5aa24948e9b016d1b5324ca6a11ec..7754d7fff5d9935422a3237ca96810e86dc0e099 100644 (file)
@@ -2076,6 +2076,13 @@ static void get_data_sync_status(const string& source_zone, list<string>& status
     return;
   }
 
+  set<int> 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:
@@ -2161,9 +2168,10 @@ static void get_data_sync_status(const string& source_zone, list<string>& 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 << "]" ;
@@ -2193,6 +2201,11 @@ static void get_data_sync_status(const string& source_zone, list<string>& 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);
 }