From: Sage Weil Date: Wed, 31 Jul 2019 00:44:59 +0000 (-0500) Subject: mon/HealthMonitor: expire mutes based on ttl X-Git-Tag: v15.1.0~1877^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ffc98aa606047274226b307746a991c773fe2b4e;p=ceph.git mon/HealthMonitor: expire mutes based on ttl Signed-off-by: Sage Weil --- diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 53325ddf7e9e..8b94cfb23344 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -349,11 +349,33 @@ void HealthMonitor::tick() if (check_leader_health()) { changed = true; } + if (check_mutes()) { + changed = true; + } if (changed) { propose_pending(); } } +bool HealthMonitor::check_mutes() +{ + bool changed = true; + auto now = ceph_clock_now(); + auto p = pending_mutes.begin(); + while (p != pending_mutes.end()) { + if (p->second.ttl != utime_t() && + p->second.ttl <= now) { + mon->clog->info() << "Health alert mute " << p->first + << " cleared (passed TTL " << p->second.ttl << ")"; + p = pending_mutes.erase(p); + changed = true; + } else { + ++p; + } + } + return changed; +} + bool HealthMonitor::check_member_health() { dout(20) << __func__ << dendl; diff --git a/src/mon/HealthMonitor.h b/src/mon/HealthMonitor.h index 113d261a1870..a9315331bd2e 100644 --- a/src/mon/HealthMonitor.h +++ b/src/mon/HealthMonitor.h @@ -46,6 +46,7 @@ public: bool check_leader_health(); bool check_member_health(); + bool check_mutes(); void create_initial() override; void update_from_paxos(bool *need_bootstrap) override;