]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWPeriod stores sync_status as vector of strings
authorCasey Bodley <cbodley@redhat.com>
Fri, 30 Oct 2015 16:18:59 +0000 (12:18 -0400)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:25 +0000 (16:13 -0800)
rgw_meta_sync_status keeps the shards in a std::map, but a std::vector
is more appropriate when all keys are present. the period also doesn't
need to store the full/incremental status in rgw_meta_sync_marker

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 2f099a4cc6803d2d1ee9bf8d209b3a86b5d1e7e6..479ca3134c27bff572c1733283b903396a728cc8 100644 (file)
@@ -1136,14 +1136,14 @@ int RGWPeriod::update_sync_status()
   }
 
   auto mdlog = store->meta_mgr->get_log();
+  const auto num_shards = cct->_conf->rgw_md_log_max_shards;
 
-  rgw_meta_sync_status status;
-  // XXX: status.state = StateInit?
-  status.sync_info.num_shards = cct->_conf->rgw_md_log_max_shards;
+  std::vector<std::string> markers;
+  markers.reserve(num_shards);
 
   // gather the markers for each shard
   // TODO: use coroutines to read them in parallel
-  for (uint32_t i = 0; i < status.sync_info.num_shards; i++) {
+  for (int i = 0; i < num_shards; i++) {
     RGWMetadataLogInfo info;
     int r = mdlog->get_info(i, &info);
     if (r < 0) {
@@ -1151,15 +1151,11 @@ int RGWPeriod::update_sync_status()
           << ": " << cpp_strerror(-r) << dendl;
       return r;
     }
-    rgw_meta_sync_marker marker;
-    // XXX: marker.state = FullSync?
-    std::swap(marker.marker, info.marker);
-    // XXX: marker.next_step_marker = ?
-    ldout(cct, 15) << "got shard " << i << " marker " << marker.marker << dendl;
-    status.sync_markers.emplace(i, std::move(marker));
+    ldout(cct, 15) << "got shard " << i << " marker " << info.marker << dendl;
+    markers.emplace_back(std::move(info.marker));
   }
 
-  sync_status = std::move(status);
+  std::swap(sync_status, markers);
   return 0;
 }
 
index 1de2a7e095d892be272350b062004985e1f42117..b00f2d1d2cd6980d3625041f7871922f8ea7f098 100644 (file)
@@ -1351,7 +1351,7 @@ class RGWPeriod
   string id;
   epoch_t epoch;
   string predecessor_uuid;
-  rgw_meta_sync_status sync_status;
+  std::vector<std::string> sync_status;
   RGWPeriodMap period_map;
   RGWPeriodConfig period_config;
   string master_zonegroup;
@@ -1388,7 +1388,7 @@ public:
   const string& get_realm() const { return realm_id; }
   const RGWPeriodMap& get_map() const { return period_map; }
   const RGWPeriodConfig& get_config() const { return period_config; }
-  const rgw_meta_sync_status& get_sync_status() const { return sync_status; }
+  const std::vector<std::string>& get_sync_status() const { return sync_status; }
   const string& get_pool_name(CephContext *cct);
   const string& get_latest_epoch_oid();
   const string& get_info_oid_prefix();
@@ -1408,10 +1408,6 @@ public:
     realm_id = _realm_id;
   }
 
-  void set_sync_status(const rgw_meta_sync_status& _sync_status) {
-    sync_status = _sync_status;
-  }
-
   void update(const RGWZoneGroupMap& map);
 
   int get_zonegroup(RGWZoneGroup& zonegroup,