summaryrefslogtreecommitdiff
path: root/src/mon
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-06-20 20:41:17 -0700
committerSamuel Just <sam.just@inktank.com>2012-06-21 17:10:29 -0700
commit0aaf7334a9823916dfad8766f1bb4239a8d399ca (patch)
treef91d6d842f4db7235aff1e3c9b8e04cc79dfef6e /src/mon
parent06288a9d10281e4a3cfdc6e69a3e1427b160571c (diff)
downloadceph-0aaf7334a9823916dfad8766f1bb4239a8d399ca.tar.gz
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 <sage@inktank.com>
Diffstat (limited to 'src/mon')
-rw-r--r--src/mon/AuthMonitor.cc2
-rw-r--r--src/mon/AuthMonitor.h18
2 files changed, 17 insertions, 3 deletions
diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc
index d9b698aefd5..c5721b96e4e 100644
--- a/src/mon/AuthMonitor.cc
+++ b/src/mon/AuthMonitor.cc
@@ -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)
diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h
index 2936b248e37..92e79373223 100644
--- a/src/mon/AuthMonitor.h
+++ b/src/mon/AuthMonitor.h
@@ -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