]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: conditionally encode auth incremental with quorum feature bits
authorSage Weil <sage@inktank.com>
Thu, 21 Jun 2012 03:41:17 +0000 (20:41 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 22 Jun 2012 00:10:29 +0000 (17:10 -0700)
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 <sage@inktank.com>
src/mon/AuthMonitor.cc
src/mon/AuthMonitor.h

index d9b698aefd5e3c5a8b0d162ee6000ef797943c30..c5721b96e4ebd860f51019dde674e642e99c7c3a 100644 (file)
@@ -223,7 +223,7 @@ void AuthMonitor::encode_pending(bufferlist &bl)
   for (vector<Incremental>::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)
index 2936b248e375363e080fdc206b27316e74e47573..92e7937322310de19f2749124c79d0b5ef23fb35 100644 (file)
@@ -19,6 +19,7 @@
 #include <set>
 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