]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: share connected features with leader
authorSage Weil <sage@redhat.com>
Tue, 30 May 2017 20:16:13 +0000 (16:16 -0400)
committerSage Weil <sage@redhat.com>
Thu, 1 Jun 2017 17:58:23 +0000 (13:58 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MMonPaxos.h
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/Paxos.cc

index 8c709ddb8e60ed467b037210062aca87b81aa2ba..4b21ee38a0ba910ff65183956372ad5e1eb47454 100644 (file)
@@ -22,7 +22,7 @@
 
 class MMonPaxos : public Message {
 
-  static const int HEAD_VERSION = 3;
+  static const int HEAD_VERSION = 4;
   static const int COMPAT_VERSION = 3;
 
  public:
@@ -63,6 +63,8 @@ class MMonPaxos : public Message {
 
   map<version_t,bufferlist> values;
 
+  bufferlist feature_map;
+
   MMonPaxos() : Message(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION) { }
   MMonPaxos(epoch_t e, int o, utime_t now) : 
     Message(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION),
@@ -103,6 +105,7 @@ public:
     ::encode(latest_version, payload);
     ::encode(latest_value, payload);
     ::encode(values, payload);
+    ::encode(feature_map, payload);
   }
   void decode_payload() override {
     bufferlist::iterator p = payload.begin();
@@ -118,6 +121,9 @@ public:
     ::decode(latest_version, p);
     ::decode(latest_value, p);
     ::decode(values, p);
+    if (header.version >= 4) {
+      ::decode(feature_map, p);
+    }
   }
 };
 
index 0d56612400477205a5df4f181f10c8820dcc4c0a..061f0d69b2d6e80dbd18a5df0c656c532a397d08 100644 (file)
@@ -1091,6 +1091,7 @@ void Monitor::_reset()
   }
   quorum.clear();
   outside_quorum.clear();
+  quorum_feature_map.clear();
 
   scrub_reset();
 
index 3f8b5950888e0d127191afd5cf58fee33a22b35b..39b23517a1fabd25f5f354626b73542fabd84f91 100644 (file)
@@ -230,6 +230,11 @@ private:
   set<int> quorum;       // current active set of monitors (if !starting)
   utime_t leader_since;  // when this monitor became the leader, if it is the leader
   utime_t exited_quorum; // time detected as not in quorum; 0 if in
+
+  // map of counts of connected clients, by type and features, for
+  // each quorum mon
+  map<int,FeatureMap> quorum_feature_map;
+
   /**
    * Intersection of quorum member's connection feature bits.
    */
index 8ba73118e0f0a4efb5a2e35ab69c9495c065a430..ff844d2a096499027cb1050f8b6db5733dbcb80d 100644 (file)
@@ -17,6 +17,7 @@
 #include "Monitor.h"
 #include "messages/MMonPaxos.h"
 
+#include "mon/mon_types.h"
 #include "common/config.h"
 #include "include/assert.h"
 #include "include/stringify.h"
@@ -1113,6 +1114,7 @@ void Paxos::handle_lease(MonOpRequestRef op)
   ack->last_committed = last_committed;
   ack->first_committed = first_committed;
   ack->lease_timestamp = ceph_clock_now();
+  ::encode(mon->session_map.feature_map, ack->feature_map);
   lease->get_connection()->send_message(ack);
 
   // (re)set timeout event.
@@ -1136,7 +1138,11 @@ void Paxos::handle_lease_ack(MonOpRequestRef op)
   }
   else if (acked_lease.count(from) == 0) {
     acked_lease.insert(from);
-    
+    if (ack->feature_map.length()) {
+      auto p = ack->feature_map.begin();
+      FeatureMap& t = mon->quorum_feature_map[from];
+      ::decode(t, p);
+    }
     if (acked_lease == mon->get_quorum()) {
       // yay!
       dout(10) << "handle_lease_ack from " << ack->get_source()