From: John Spray Date: Fri, 5 Sep 2014 11:49:53 +0000 (+0100) Subject: mon: trigger transaction on MDS health changes X-Git-Tag: v0.86~68^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=05d69580b0cd92c6d124bbd89a01d14938600d68;p=ceph.git mon: trigger transaction on MDS health changes I think this was previously only working as a side effect of other MDS map changes. Signed-off-by: John Spray --- diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index 60adeadbe43e..dd79493a573f 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -75,6 +75,11 @@ struct MDSHealthMetric DECODE_FINISH(bl); } + bool operator==(MDSHealthMetric const &other) const + { + return (type == other.type && sev == other.sev && message == other.message); + } + MDSHealthMetric() : type(MDS_HEALTH_NULL), sev(HEALTH_OK) {} MDSHealthMetric(mds_metric_t type_, health_status_t sev_, std::string const &message_) : type(type_), sev(sev_), message(message_) {} @@ -101,6 +106,11 @@ struct MDSHealth ::decode(metrics, bl); DECODE_FINISH(bl); } + + bool operator==(MDSHealth const &other) const + { + return metrics == other.metrics; + } }; WRITE_CLASS_ENCODER(MDSHealth) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 3139c9dd8d30..520eb6947c97 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -319,6 +319,14 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) return false; // need to update map } + // Comparing known daemon health with m->get_health() + // and return false (i.e. require proposal) if they + // do not match, to update our stored + if (!(pending_daemon_health[gid] == m->get_health())) { + dout(20) << __func__ << " health metrics for gid " << gid << " were updated" << dendl; + return false; + } + ignore: // note time and reply _note_beacon(m);