]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: require MON_GV protocol feature
authorSage Weil <sage@inktank.com>
Thu, 13 Sep 2012 00:49:24 +0000 (17:49 -0700)
committerSage Weil <sage@inktank.com>
Wed, 19 Sep 2012 18:53:45 +0000 (11:53 -0700)
Require the MON_GV feature when

 - we see the ondisk feature is set on bootup
 - we enable the ondisk feature

This means that once we form a quorum with the feature and enable it on
disk, there is no going back; we won't be able to talk to old monitors
without the feature, and a downgrade won't be possible.

Hopefully, in practice, any monitors with old code will be up at the time
we are upgrading, such that the quorum will not include the feature and we
won't make the transition.  Otherwise, if they are down, and the remaining
nodes have the feature and enable it, and the old code starts up, it won't
be able ot join until it is upgraded to the new code as well.

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

index 2c7bb8af8dcade400e733db4a356edfe693a7c20..724fda9d5c741270428dc5770ae025ddb7e83ca6 100644 (file)
@@ -216,6 +216,7 @@ void Monitor::recovered_leader(int id)
     if (!features.incompat.contains(CEPH_MON_FEATURE_INCOMPAT_GV) &&
        (quorum_features & CEPH_FEATURE_MON_GV)) {
       require_gv_ondisk();
+      require_gv_onwire();
     }
 
     for (vector<Paxos*>::iterator p = paxos.begin(); p != paxos.end(); p++)
@@ -240,8 +241,8 @@ void Monitor::recovered_peon(int id)
     if (!features.incompat.contains(CEPH_MON_FEATURE_INCOMPAT_GV) &&
        (quorum_features & CEPH_FEATURE_MON_GV)) {
       require_gv_ondisk();
+      require_gv_onwire();
     }
-
   }
 }
 
@@ -252,6 +253,15 @@ void Monitor::require_gv_ondisk()
   write_features();
 }
 
+void Monitor::require_gv_onwire()
+{
+  dout(10) << "require_gv_onwire" << dendl;
+  // require protocol feature bit of my peers
+  Messenger::Policy p = messenger->get_policy(entity_name_t::TYPE_MON);
+  p.features_required |= CEPH_FEATURE_MON_GV;
+  messenger->set_policy(entity_name_t::TYPE_MON, p);
+}
+
 version_t Monitor::get_global_paxos_version()
 {
   // this should only be called when paxos becomes writeable, which is
@@ -381,6 +391,9 @@ void Monitor::read_features()
   bufferlist::iterator p = bl.begin();
   ::decode(features, p);
   dout(10) << "features " << features << dendl;
+
+  if (features.incompat.contains(CEPH_MON_FEATURE_INCOMPAT_GV))
+    require_gv_onwire();
 }
 
 void Monitor::write_features()
index a7513670e2e2b0c6032a296f86feaa55a1d6e597..d71d3597066034fca7efd966a4a2a879bac652dc 100644 (file)
@@ -192,6 +192,7 @@ private:
   version_t global_version;
 
   void require_gv_ondisk();
+  void require_gv_onwire();
 
 public:
   void recovered_leader(int id);