From 1ac56b7d7a533714dba62d36e7f0897d0d068afe Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 23 Nov 2009 14:45:00 -0800 Subject: [PATCH] mon: avoid mds state update when clearing laggy flag Do not clear laggy flag (or otherwise get into prepare_update) if the mds hasn't seen the latest map. Previously we could go to clear laggy and also revert to an old mds state. --- src/mon/MDSMonitor.cc | 54 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 8e7008139ea67..acc2151217acd 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -179,42 +179,38 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) goto out; } - // can i handle this query without a map update? + if (mdsmap.get_epoch() != m->get_last_epoch_seen()) { + dout(10) << "mds_beacon " << *m + << " ignoring requested state, because mds hasn't seen latest map" << dendl; + goto ignore; + } if (info.laggy()) { return false; // no longer laggy, need to update map. } - else if (state == MDSMap::STATE_BOOT) { + if (state == MDSMap::STATE_BOOT) { // ignore, already booted. goto out; } - else { - // is there a state change here? - if (info.state != state) { - if (mdsmap.get_epoch() != m->get_last_epoch_seen()) { - dout(10) << "mds_beacon " << *m - << " ignoring requested state, because mds hasn't seen latest map" << dendl; - goto ignore; - } - - // legal state change? - if ((info.state == MDSMap::STATE_STANDBY || - info.state == MDSMap::STATE_STANDBY_REPLAY) && state > 0) { - dout(10) << "mds_beacon mds can't activate itself (" << ceph_mds_state_name(info.state) - << " -> " << ceph_mds_state_name(state) << ")" << dendl; - goto ignore; - } - - if (info.state == MDSMap::STATE_STANDBY && - state == MDSMap::STATE_STANDBY_REPLAY && - (pending_mdsmap.is_degraded() || - pending_mdsmap.get_state(info.rank) < MDSMap::STATE_ACTIVE)) { - dout(10) << "mds_beacon can't standby-replay mds" << info.rank << " at this time (cluster degraded, or mds not active)" << dendl; - goto ignore; - } - - return false; // need to update map + // is there a state change here? + if (info.state != state) { + // legal state change? + if ((info.state == MDSMap::STATE_STANDBY || + info.state == MDSMap::STATE_STANDBY_REPLAY) && state > 0) { + dout(10) << "mds_beacon mds can't activate itself (" << ceph_mds_state_name(info.state) + << " -> " << ceph_mds_state_name(state) << ")" << dendl; + goto ignore; } + + if (info.state == MDSMap::STATE_STANDBY && + state == MDSMap::STATE_STANDBY_REPLAY && + (pending_mdsmap.is_degraded() || + pending_mdsmap.get_state(info.rank) < MDSMap::STATE_ACTIVE)) { + dout(10) << "mds_beacon can't standby-replay mds" << info.rank << " at this time (cluster degraded, or mds not active)" << dendl; + goto ignore; + } + + return false; // need to update map } ignore: @@ -299,7 +295,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m) MDSMap::mds_info_t& info = pending_mdsmap.get_info_gid(gid); if (info.laggy()) { - dout(10) << "prepare_beacon clearly laggy flag on " << addr << dendl; + dout(10) << "prepare_beacon clearing laggy flag on " << addr << dendl; info.clear_laggy(); } -- 2.39.5