From: Sage Weil Date: Thu, 21 Jun 2012 03:41:17 +0000 (-0700) Subject: mon: conditionally encode auth incremental with quorum feature bits X-Git-Tag: v0.48argonaut~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0aaf7334a9823916dfad8766f1bb4239a8d399ca;p=ceph.git mon: conditionally encode auth incremental with quorum feature bits If the quorum does not yet all have the MONENC feature, stick to the old encoding. It might be more polite to require a super-quorum before switching over, and take note so that thereafter we can stick to the new encoding, but that has more moving parts and I'm not sure it's worth the complexity. Signed-off-by: Sage Weil --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index d9b698aefd5e..c5721b96e4eb 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -223,7 +223,7 @@ void AuthMonitor::encode_pending(bufferlist &bl) for (vector::iterator p = pending_auth.begin(); p != pending_auth.end(); p++) - p->encode(bl); + p->encode(bl, mon->get_quorum_features()); } bool AuthMonitor::preprocess_query(PaxosServiceMessage *m) diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index 2936b248e375..92e793732231 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -19,6 +19,7 @@ #include using namespace std; +#include "include/ceph_features.h" #include "include/types.h" #include "msg/Messenger.h" #include "PaxosService.h" @@ -47,7 +48,20 @@ public: Incremental() : inc_type(GLOBAL_ID), max_global_id(0), auth_type(0) {} - void encode(bufferlist& bl) const { + void encode(bufferlist& bl, uint64_t features=-1) const { + if ((features & CEPH_FEATURE_MONENC) == 0) { + __u8 v = 1; + ::encode(v, bl); + __u32 _type = (__u32)inc_type; + ::encode(_type, bl); + if (_type == GLOBAL_ID) { + ::encode(max_global_id, bl); + } else { + ::encode(auth_type, bl); + ::encode(auth_data, bl); + } + return; + } ENCODE_START(2, 2, bl); __u32 _type = (__u32)inc_type; ::encode(_type, bl); @@ -138,6 +152,6 @@ private: }; -WRITE_CLASS_ENCODER(AuthMonitor::Incremental); +WRITE_CLASS_ENCODER_FEATURES(AuthMonitor::Incremental); #endif