From 259fffbed4d5c828b2fd97c53ea37342470f7643 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 12 Sep 2012 17:49:24 -0700 Subject: [PATCH] mon: require MON_GV protocol feature 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 --- src/mon/Monitor.cc | 15 ++++++++++++++- src/mon/Monitor.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 2c7bb8af8dcad..724fda9d5c741 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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::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() diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index a7513670e2e2b..d71d359706603 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -192,6 +192,7 @@ private: version_t global_version; void require_gv_ondisk(); + void require_gv_onwire(); public: void recovered_leader(int id); -- 2.39.5