From 3eb913e488c914d86eca2a4d31b050ea18914fa2 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Wed, 21 Jun 2017 12:37:21 +0300 Subject: [PATCH] rgw: log_meta only for more than one zone Fixes: http://tracker.ceph.com/issues/20357 Signed-off-by: Orit Wasserman (cherry picked from commit 088dba03ccc65609ef1c51306389ebcf1126ec8c) --- src/rgw/rgw_rados.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 121782c9de62..80f11622ef63 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1498,6 +1498,22 @@ public: bool is_single_zonegroup(CephContext *cct, RGWRados *store); + /* + returns true if there are several zone groups with a least one zone + */ + bool is_multi_zonegroups_with_zones() + { + int count = 0; + for (const auto& zg: period_map.zonegroups) { + if (zg.second.zones.size() > 0) { + if (count++ > 0) { + return true; + } + } + } + return false; + } + int get_latest_epoch(epoch_t& epoch); int set_latest_epoch(epoch_t epoch, bool exclusive = false); @@ -3005,7 +3021,8 @@ public: } bool need_to_log_metadata() { - return is_meta_master() && get_zone().log_meta; + return is_meta_master() && + (get_zonegroup().zones.size() > 1 || current_period.is_multi_zonegroups_with_zones()); } librados::Rados* get_rados_handle(); -- 2.47.3