]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_admin: read master log shards from master's current period 13176/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 13 Jan 2017 15:32:55 +0000 (16:32 +0100)
committerNathan Cutler <ncutler@suse.com>
Sun, 29 Jan 2017 09:46:30 +0000 (10:46 +0100)
Also make the sync output look similar to the output of data sync
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit cc306c506ca6607223cb89cd388f8e18673c4fe2)

src/rgw/rgw_admin.cc

index 7da25fed670e74f3b1ea47c4a15aadde66bbe8d2..5271909b1c02dbc5a1c7493cefca594e8b35a2fb 100644 (file)
@@ -1793,21 +1793,19 @@ static void get_md_sync_status(list<string>& status)
     return;
   }
 
-
   map<int, RGWMetadataLogInfo> master_shards_info;
-  string master_start_period;
+  string master_period = store->get_current_period_id();
 
-  ret = sync.read_master_log_shards_info(&master_start_period, &master_shards_info);
+  ret = sync.read_master_log_shards_info(master_period, &master_shards_info);
   if (ret < 0) {
     status.push_back(string("failed to fetch master sync status: ") + cpp_strerror(-ret));
     return;
   }
 
   map<int, string> shards_behind;
-  if (store->get_current_period_id() !=  sync_status.sync_info.period) {
+  if (sync_status.sync_info.period != master_period) {
     status.push_back(string("master is on a different period: master_period=" +
-                            store->get_current_period_id() + " local_period=" +
-                            sync_status.sync_info.period));
+                            master_period + " local_period=" + sync_status.sync_info.period));
   } else {
     for (auto local_iter : sync_status.sync_markers) {
       int shard_id = local_iter.first;
@@ -1827,7 +1825,7 @@ static void get_md_sync_status(list<string>& status)
 
   int total_behind = shards_behind.size() + (sync_status.sync_info.num_shards - num_inc);
   if (total_behind == 0) {
-    status.push_back("metadata is caught up with master");
+    push_ss(ss, status) << "metadata is caught up with master";
   } else {
     push_ss(ss, status) << "metadata is behind on " << total_behind << " shards";