diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index e1d092a54a9..249f1a223e6 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -438,6 +438,7 @@ int MDS::init() // schedule tick reset_tick(); + last_tick = g_clock.now(); mds_lock.Unlock(); return 0; @@ -464,8 +465,18 @@ void MDS::tick() logclient.send_log(); + utime_t now = g_clock.now(); + utime_t delay = now; + delay -= last_tick; + if (delay > g_conf.mds_session_timeout / 2) { + dout(0) << " last tick was " << delay << " > " << g_conf.mds_tick_interval + << " seconds ago, laggy_until " << laggy_until + << ", setting laggy flag" << dendl; + laggy = true; + } if (laggy) return; + last_tick = now; // make sure mds log flushes, trims periodically mdlog->flush(); @@ -478,7 +489,6 @@ void MDS::tick() } // log - utime_t now = g_clock.now(); mds_load_t load = balancer->get_load(now); if (logger) { @@ -569,6 +579,7 @@ void MDS::handle_mds_beacon(MMDSBeacon *m) dout(1) << " clearing laggy flag" << dendl; laggy = false; laggy_until = now; + last_tick = now; // so that tick() will start up again queue_waiters(waiting_for_nolaggy); } diff --git a/src/mds/MDS.h b/src/mds/MDS.h index 6b519e1a44c..f40a79fc5a5 100644 --- a/src/mds/MDS.h +++ b/src/mds/MDS.h @@ -258,6 +258,7 @@ class MDS : public Dispatcher { utime_t beacon_last_acked_stamp; // last time we sent a beacon that got acked bool laggy; utime_t laggy_until; + utime_t last_tick; bool is_laggy() { return laggy; } utime_t get_laggy_until() { return laggy_until; }