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: v14.0.1~24^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4014441b8d9ad446f01c3a59d6720bb888457330;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 --- diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index 8d54a8218ec3..52c9a9bb71b2 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -78,7 +78,9 @@ void Beacon::init(const MDSMap &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; } @@ -179,7 +181,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(); @@ -188,7 +190,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; @@ -221,6 +223,7 @@ void Beacon::_send() } monc->send_mon_message(beacon.detach()); last_send = now; + return true; } /** diff --git a/src/mds/Beacon.h b/src/mds/Beacon.h index a06df4cbe68d..f01fba2a1ee5 100644 --- a/src/mds/Beacon.h +++ b/src/mds/Beacon.h @@ -84,7 +84,7 @@ public: private: void _notify_mdsmap(const MDSMap &mdsmap); - void _send(); + bool _send(); mutable std::mutex mutex; std::thread sender;