From: Sage Weil Date: Wed, 9 Apr 2014 18:13:31 +0000 (-0700) Subject: mon: refresh elector required_features when they change X-Git-Tag: v0.80-rc1~69^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=34d69cdcfa21d2395415677be7c3b81bb0e67641;p=ceph.git mon: refresh elector required_features when they change Currently we only refresh required_features on Elector::start(). This does not prevent an old peer from calling an election (even though they won't succeed in joining the resulting quorum). Fix this by updating the elector's features when they change. This way we don't allow a useless election cycle just to trigger that update in start(). Signed-off-by: Sage Weil --- diff --git a/src/mon/Elector.cc b/src/mon/Elector.cc index 539b291cd35e..1f768b877647 100644 --- a/src/mon/Elector.cc +++ b/src/mon/Elector.cc @@ -65,6 +65,11 @@ void Elector::bump_epoch(epoch_t e) } +void Elector::refresh_required_features() +{ + required_features = mon->apply_compatset_features_to_quorum_requirements(); +} + void Elector::start() { if (!participating) { diff --git a/src/mon/Elector.h b/src/mon/Elector.h index b88e8304aacc..9122a5590097 100644 --- a/src/mon/Elector.h +++ b/src/mon/Elector.h @@ -391,6 +391,14 @@ class Elector { bump_epoch(epoch + 1); } + /** + * Refresh required features + * + * Force a refresh of the features we require for others to join in + * on an election. + */ + void refresh_required_features(); + /** * Handle received messages. * diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 7e29e14cd2f5..be0046beb9f4 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1666,6 +1666,8 @@ void Monitor::apply_quorum_to_compatset_features() MonitorDBStore::Transaction t; write_features(t); store->apply_transaction(t); + + elector.refresh_required_features(); } }