From 3aa3b4b60d17d0417bbd6fef4141addb1f4d55f4 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 21 Jul 2017 18:00:26 +0800 Subject: [PATCH] mon/HealthMonitor: trigger a proposal if stat updated leader should always propose if the peon update it with new health stats Signed-off-by: Kefu Chai --- src/mon/HealthMonitor.cc | 26 +++++++++++++++----------- src/mon/HealthMonitor.h | 1 - 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 32f62667e25f1..af2af807ead0b 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -152,7 +152,15 @@ version_t HealthMonitor::get_trim_to() bool HealthMonitor::preprocess_query(MonOpRequestRef op) { - switch (op->get_req()->get_type()) { + return false; +} + +bool HealthMonitor::prepare_update(MonOpRequestRef op) +{ + Message *m = op->get_req(); + dout(7) << "prepare_update " << *m + << " from " << m->get_orig_source_inst() << dendl; + switch (m->get_type()) { case MSG_MON_HEALTH: { MMonHealth *hm = static_cast(op->get_req()); @@ -164,22 +172,18 @@ bool HealthMonitor::preprocess_query(MonOpRequestRef op) } return services[service_type]->service_dispatch(op); } - case MSG_MON_HEALTH_CHECKS: - return preprocess_health_checks(op); + return prepare_health_checks(op); + default: + return false; } - return false; -} - -bool HealthMonitor::prepare_update(MonOpRequestRef op) -{ - return false; } -bool HealthMonitor::preprocess_health_checks(MonOpRequestRef op) +bool HealthMonitor::prepare_health_checks(MonOpRequestRef op) { MMonHealthChecks *m = static_cast(op->get_req()); - quorum_checks[m->get_source().num()] = m->health_checks; + // no need to check if it's changed, the peon has done so + quorum_checks[m->get_source().num()] = std::move(m->health_checks); return true; } diff --git a/src/mon/HealthMonitor.h b/src/mon/HealthMonitor.h index 5387ce0340a89..342778dbc2231 100644 --- a/src/mon/HealthMonitor.h +++ b/src/mon/HealthMonitor.h @@ -47,7 +47,6 @@ public: bool preprocess_query(MonOpRequestRef op) override; bool prepare_update(MonOpRequestRef op) override; - bool preprocess_health_checks(MonOpRequestRef op); bool prepare_health_checks(MonOpRequestRef op); bool check_leader_health(); -- 2.47.3