From: Samuel Just Date: Thu, 31 Mar 2011 23:16:43 +0000 (-0700) Subject: MDSMonitor: MDS do not standby replay until other is active X-Git-Tag: v0.27~179 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5d998a7a0d9d100d8512ece4bca710d8e1810380;p=ceph.git MDSMonitor: MDS do not standby replay until other is active Previously, an mds could go into standby replay before the mds which it is replaying has finished creating. Signed-off-by: Samuel Just --- diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index 46160f98c175..31713582e441 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -396,6 +396,15 @@ public: bool is_stopping(int m) { return get_state(m) == STATE_STOPPING; } bool is_clientreplay_or_active_or_stopping(int m) { return is_clientreplay(m) || is_active(m) || is_stopping(m); } + bool is_followable(int m) { + return (is_resolve(m) || + is_replay(m) || + is_rejoin(m) || + is_clientreplay(m) || + is_active(m) || + is_stopping(m)); + } + bool is_laggy_gid(uint64_t gid) { return mds_info.count(gid) && mds_info[gid].laggy(); } diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 3223d6dc61af..2d52e34e588a 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -355,7 +355,8 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m) info.standby_for_rank = mdsmap.find_by_name(info.standby_for_name)->rank; } - if (info.standby_for_rank >= 0 && !mdsmap.is_dne(info.standby_for_rank)) { + if (info.standby_for_rank >= 0 && + mdsmap.is_followable(info.standby_for_rank)) { info.state = MDSMap::STATE_STANDBY_REPLAY; } @@ -399,7 +400,8 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m) << " to STANDBY_REPLAY for" << dendl; const MDSMap::mds_info_t *found_mds = NULL; if ((found_mds = mdsmap.find_by_name(m->get_standby_for_name())) && - (found_mds->rank >= 0)) { + (found_mds->rank >= 0) && + mdsmap.is_followable(found_mds->rank)) { info.standby_for_rank = found_mds->rank; dout(10) <<" found mds " << m->get_standby_for_name() << "; it has rank " << info.standby_for_rank << dendl; @@ -410,7 +412,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m) return false; } } else if (m->get_standby_for_rank() >= 0 && - !mdsmap.is_dne(m->get_standby_for_rank())) { + mdsmap.is_followable(m->get_standby_for_rank())) { /* switch to standby-replay for this MDS*/ info.state = MDSMap::STATE_STANDBY_REPLAY; info.state_seq = seq; @@ -939,7 +941,8 @@ void MDSMonitor::tick() for (map::iterator i = pending_mdsmap.mds_info.begin(); i != pending_mdsmap.mds_info.end(); ++i) { - if (i->second.rank >= 0) { + if (i->second.rank >= 0 && + mdsmap.is_followable(i->second.rank)) { if ((gid = pending_mdsmap.find_standby_for( i->second.rank, i->second.name))) { dout(20) << "checking rank " << i->second.rank << dendl;