From: Sage Weil Date: Tue, 30 May 2017 20:16:13 +0000 (-0400) Subject: mon: share connected features with leader X-Git-Tag: v12.1.0~244^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=751514f8a82e444e6870e51034d15f8beb44019c;p=ceph.git mon: share connected features with leader Signed-off-by: Sage Weil --- diff --git a/src/messages/MMonPaxos.h b/src/messages/MMonPaxos.h index 8c709ddb8e6..4b21ee38a0b 100644 --- a/src/messages/MMonPaxos.h +++ b/src/messages/MMonPaxos.h @@ -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 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); + } } }; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 0d566124004..061f0d69b2d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1091,6 +1091,7 @@ void Monitor::_reset() } quorum.clear(); outside_quorum.clear(); + quorum_feature_map.clear(); scrub_reset(); diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 3f8b5950888..39b23517a1f 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -230,6 +230,11 @@ private: set 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 quorum_feature_map; + /** * Intersection of quorum member's connection feature bits. */ diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 8ba73118e0f..ff844d2a096 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -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()