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(); }
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;
}
<< " 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;
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;
for (map<uint64_t,MDSMap::mds_info_t>::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;