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 <sage@inktank.com>
}
+void Elector::refresh_required_features()
+{
+ required_features = mon->apply_compatset_features_to_quorum_requirements();
+}
+
void Elector::start()
{
if (!participating) {
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.
*
MonitorDBStore::Transaction t;
write_features(t);
store->apply_transaction(t);
+
+ elector.refresh_required_features();
}
}