From: Kefu Chai Date: Fri, 21 Jul 2017 10:00:26 +0000 (+0800) Subject: mon/HealthMonitor: trigger a proposal if stat updated X-Git-Tag: v12.1.2~166^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16477%2Fhead;p=ceph.git 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 --- diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 32f62667e25..af2af807ead 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 5387ce0340a..342778dbc22 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();