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 <john.spray@redhat.com>
This commit is contained in:
John Spray 2014-09-05 12:49:53 +01:00
parent e6062b8d33
commit 05d69580b0
2 changed files with 18 additions and 0 deletions

View File

@ -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)

View File

@ -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);