From 77204a9df7fc9b4add05cfcb229598c701f88135 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Jan 2019 13:05:53 -0600 Subject: [PATCH] mon/MonmapMonitor: increase min_mon_release when full quorum is upgraded Signed-off-by: Sage Weil --- src/mon/MonmapMonitor.cc | 56 +++++++++++++++++++++++----------------- src/mon/MonmapMonitor.h | 3 ++- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 5d7358729f7..94a51c1846c 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -112,12 +112,13 @@ void MonmapMonitor::encode_pending(MonitorDBStore::TransactionRef t) class C_ApplyFeatures : public Context { MonmapMonitor *svc; mon_feature_t features; - public: - C_ApplyFeatures(MonmapMonitor *s, const mon_feature_t& f) : - svc(s), features(f) { } + int min_mon_release; +public: + C_ApplyFeatures(MonmapMonitor *s, const mon_feature_t& f, int mmr) : + svc(s), features(f), min_mon_release(mmr) { } void finish(int r) override { if (r >= 0) { - svc->apply_mon_features(features); + svc->apply_mon_features(features, min_mon_release); } else if (r == -EAGAIN || r == -ECANCELED) { // discard features if we're no longer on the quorum that // established them in the first place. @@ -128,11 +129,17 @@ class C_ApplyFeatures : public Context { } }; -void MonmapMonitor::apply_mon_features(const mon_feature_t& features) +void MonmapMonitor::apply_mon_features(const mon_feature_t& features, + int min_mon_release) { if (!is_writeable()) { dout(5) << __func__ << " wait for service to be writeable" << dendl; - wait_for_writeable_ctx(new C_ApplyFeatures(this, features)); + wait_for_writeable_ctx(new C_ApplyFeatures(this, features, min_mon_release)); + return; + } + + // do nothing here unless we have a full quorum + if (mon->get_quorum().size() < mon->monmap->size()) { return; } @@ -146,28 +153,28 @@ void MonmapMonitor::apply_mon_features(const mon_feature_t& features) (pending_map.persistent_features ^ (features & ceph::features::mon::get_persistent())); - if (new_features.empty()) { - dout(10) << __func__ << " features match current pending: " - << features << dendl; + if (new_features.empty() && + pending_map.min_mon_release == min_mon_release) { + dout(10) << __func__ << " min_mon_release (" << min_mon_release + << ") and features (" << features << ") match" << dendl; return; } - if (mon->get_quorum().size() < mon->monmap->size()) { - dout(1) << __func__ << " new features " << new_features - << " contains features that require a full quorum" - << " (quorum size is " << mon->get_quorum().size() - << ", requires " << mon->monmap->size() << "): " - << new_features - << " -- do not enable them!" << dendl; - return; + if (!new_features.empty()) { + dout(1) << __func__ << " applying new features " + << new_features << ", had " << pending_map.persistent_features + << ", will have " + << (new_features | pending_map.persistent_features) + << dendl; + pending_map.persistent_features |= new_features; + } + if (min_mon_release > pending_map.min_mon_release) { + dout(1) << __func__ << " increasing min_mon_release to " + << min_mon_release << " (" << ceph_release_name(min_mon_release) + << ")" << dendl; + pending_map.min_mon_release = min_mon_release; } - new_features |= pending_map.persistent_features; - - dout(5) << __func__ << " applying new features to monmap;" - << " had " << pending_map.persistent_features - << ", will have " << new_features << dendl; - pending_map.persistent_features = new_features; propose_pending(); } @@ -193,7 +200,8 @@ void MonmapMonitor::on_active() mon->clog->debug() << "monmap " << *mon->monmap; } - apply_mon_features(mon->get_quorum_mon_features()); + apply_mon_features(mon->get_quorum_mon_features(), + mon->quorum_min_mon_release); } bool MonmapMonitor::preprocess_query(MonOpRequestRef op) diff --git a/src/mon/MonmapMonitor.h b/src/mon/MonmapMonitor.h index 6268194afb5..042e1497654 100644 --- a/src/mon/MonmapMonitor.h +++ b/src/mon/MonmapMonitor.h @@ -52,7 +52,8 @@ class MonmapMonitor : public PaxosService { void encode_full(MonitorDBStore::TransactionRef t) override { } void on_active() override; - void apply_mon_features(const mon_feature_t& features); + void apply_mon_features(const mon_feature_t& features, + int min_mon_release); void dump_info(Formatter *f); -- 2.39.5