From 4014441b8d9ad446f01c3a59d6720bb888457330 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 9 Oct 2018 15:50:22 -0700 Subject: [PATCH] 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 --- src/mds/Beacon.cc | 9 ++++++--- src/mds/Beacon.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index 8d54a8218ec35..52c9a9bb71b22 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 a06df4cbe68d8..f01fba2a1ee5a 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; -- 2.39.5