From: Patrick Donnelly Date: Tue, 9 Oct 2018 22:50:22 +0000 (-0700) Subject: mds: wait shorter intervals if beacon not sent X-Git-Tag: v13.2.5~91^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25980%2Fhead;p=ceph.git mds: wait shorter intervals if beacon not sent MDS beacon upkeep always waits mds_beacon_interval seconds even when laggy. Check more frequently for when we stop being laggy to reduce likelihood that the MDS is removed. Signed-off-by: Patrick Donnelly (cherry picked from commit 4014441b8d9ad446f01c3a59d6720bb888457330) Conflicts: src/mds/Beacon.h : Resolved for _send --- diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index a013c391398b..36e8c7c12cf5 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -80,7 +80,9 @@ void Beacon::init(MDSMap const *mdsmap) auto since = std::chrono::duration(now-last_send).count(); auto interval = beacon_interval; if (since >= interval*.90) { - _send(); + if (!_send()) { + interval = 0.5; /* 500ms */ + } } else { interval -= since; } @@ -185,7 +187,7 @@ void Beacon::send_and_wait(const double duration) /** * Call periodically, or when you have updated the desired state */ -void Beacon::_send() +bool Beacon::_send() { auto now = clock::now(); auto since = std::chrono::duration(now-last_acked_stamp).count(); @@ -194,7 +196,7 @@ void Beacon::_send() /* If anything isn't progressing, let avoid sending a beacon so that * the MDS will consider us laggy */ dout(0) << "Skipping beacon heartbeat to monitors (last acked " << since << "s ago); MDS internal heartbeat is not healthy!" << dendl; - return; + return false; } ++last_seq; @@ -227,6 +229,7 @@ void Beacon::_send() } monc->send_mon_message(beacon); last_send = now; + return true; } /** diff --git a/src/mds/Beacon.h b/src/mds/Beacon.h index b7fbe27ec19c..142de080074c 100644 --- a/src/mds/Beacon.h +++ b/src/mds/Beacon.h @@ -85,7 +85,7 @@ public: private: void _notify_mdsmap(MDSMap const *mdsmap); - void _send(); + bool _send(); mutable std::mutex mutex; std::thread sender;