if (up.count(rank) != 0) {
name = mds_info.at(up.at(rank)).name;
}
- const bool standby_avail = find_replacement_for(rank, name) != MDS_GID_NONE;
+ const mds_rank_t replacement = find_replacement_for(rank, name, false);
+ const bool standby_avail = replacement != MDS_GID_NONE;
// If the rank is unfilled, and there are no standbys, we're unavailable
if (up.count(rank) == 0 && !standby_avail) {
return MDS_GID_NONE;
}
- mds_gid_t find_unused_for(mds_rank_t mds, std::string& name) const {
+ mds_gid_t find_unused_for(mds_rank_t mds, std::string& name,
+ bool force_standby_active) const {
for (std::map<mds_gid_t,mds_info_t>::const_iterator p = mds_info.begin();
p != mds_info.end();
++p) {
continue;
if ((p->second.standby_for_rank == MDS_NO_STANDBY_PREF ||
p->second.standby_for_rank == MDS_MATCHED_ACTIVE ||
- (p->second.standby_for_rank == MDS_STANDBY_ANY && g_conf->mon_force_standby_active))) {
+ (p->second.standby_for_rank == MDS_STANDBY_ANY && force_standby_active))) {
return p->first;
}
}
return MDS_GID_NONE;
}
- mds_gid_t find_replacement_for(mds_rank_t mds, std::string& name) const {
+ mds_gid_t find_replacement_for(mds_rank_t mds, std::string& name,
+ bool force_standby_active) const {
const mds_gid_t standby = find_standby_for(mds, name);
if (standby)
return standby;
else
- return find_unused_for(mds, name);
+ return find_unused_for(mds, name, force_standby_active);
}
void get_health(list<pair<health_status_t,std::string> >& summary,
string name;
while (pending_mdsmap.is_in(mds))
mds++;
- mds_gid_t newgid = pending_mdsmap.find_replacement_for(mds, name);
+ mds_gid_t newgid = pending_mdsmap.find_replacement_for(mds, name,
+ g_conf->mon_force_standby_active);
if (!newgid)
break;
if (info.rank >= 0 &&
info.state != MDSMap::STATE_STANDBY &&
info.state != MDSMap::STATE_STANDBY_REPLAY &&
- (sgid = pending_mdsmap.find_replacement_for(info.rank, info.name)) != MDS_GID_NONE) {
+ (sgid = pending_mdsmap.find_replacement_for(info.rank, info.name,
+ g_conf->mon_force_standby_active)) != MDS_GID_NONE) {
MDSMap::mds_info_t& si = pending_mdsmap.mds_info[sgid];
dout(10) << " replacing " << gid << " " << info.addr << " mds." << info.rank << "." << info.inc
<< " " << ceph_mds_state_name(info.state)
while (p != failed.end()) {
mds_rank_t f = *p++;
string name; // FIXME
- mds_gid_t sgid = pending_mdsmap.find_replacement_for(f, name);
+ mds_gid_t sgid = pending_mdsmap.find_replacement_for(f, name,
+ g_conf->mon_force_standby_active);
if (sgid) {
MDSMap::mds_info_t& si = pending_mdsmap.mds_info[sgid];
dout(0) << " taking over failed mds." << f << " with " << sgid << "/" << si.name << " " << si.addr << dendl;