]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: log_meta only for more than one zone
authorOrit Wasserman <owasserm@redhat.com>
Wed, 21 Jun 2017 09:37:21 +0000 (12:37 +0300)
committerNathan Cutler <ncutler@suse.com>
Tue, 12 Sep 2017 06:58:47 +0000 (08:58 +0200)
Fixes: http://tracker.ceph.com/issues/20357
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
(cherry picked from commit 088dba03ccc65609ef1c51306389ebcf1126ec8c)

src/rgw/rgw_rados.h

index 121782c9de624f6da0d8cf5c9688fb0c529f061e..80f11622ef63bdff533bfa64bb81cba743fa4836 100644 (file)
@@ -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();