From 31913902c616551f84bdf0aafe71ed98ff1e2d14 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 30 Oct 2015 12:18:59 -0400 Subject: [PATCH] rgw: RGWPeriod stores sync_status as vector of strings 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 --- src/rgw/rgw_rados.cc | 18 +++++++----------- src/rgw/rgw_rados.h | 8 ++------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2f099a4cc6803..479ca3134c27b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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 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; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 1de2a7e095d89..b00f2d1d2cd69 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1351,7 +1351,7 @@ class RGWPeriod string id; epoch_t epoch; string predecessor_uuid; - rgw_meta_sync_status sync_status; + std::vector 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& 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, -- 2.39.5