]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: refresh elector required_features when they change
authorSage Weil <sage@inktank.com>
Wed, 9 Apr 2014 18:13:31 +0000 (11:13 -0700)
committerSage Weil <sage@inktank.com>
Wed, 9 Apr 2014 18:13:31 +0000 (11:13 -0700)
Currently we only refresh required_features on Elector::start().  This
does not prevent an old peer from calling an election (even though they
won't succeed in joining the resulting quorum).

Fix this by updating the elector's features when they change.  This way we
don't allow a useless election cycle just to trigger that update in
start().

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Elector.cc
src/mon/Elector.h
src/mon/Monitor.cc

index 539b291cd35e36b2ccb428c806b08730aea5884a..1f768b8776470a5f165208b0a9614aea5449bb05 100644 (file)
@@ -65,6 +65,11 @@ void Elector::bump_epoch(epoch_t e)
 }
 
 
+void Elector::refresh_required_features()
+{
+  required_features = mon->apply_compatset_features_to_quorum_requirements();
+}
+
 void Elector::start()
 {
   if (!participating) {
index b88e8304aacc61c300d7bd15da327cbafdadb5d3..9122a5590097c062e66df15261f1df3e06dcde4d 100644 (file)
@@ -391,6 +391,14 @@ class Elector {
     bump_epoch(epoch + 1);
   }
 
+  /**
+   * Refresh required features
+   *
+   * Force a refresh of the features we require for others to join in
+   * on an election.
+   */
+  void refresh_required_features();
+
   /**
    * Handle received messages.
    *
index 7e29e14cd2f5d6f6b6e223fa626e2e4ee8bb27de..be0046beb9f49cd7279b36d0038f9e179cb69e81 100644 (file)
@@ -1666,6 +1666,8 @@ void Monitor::apply_quorum_to_compatset_features()
     MonitorDBStore::Transaction t;
     write_features(t);
     store->apply_transaction(t);
+
+    elector.refresh_required_features();
   }
 }