From: John Spray Date: Thu, 25 May 2017 11:38:21 +0000 (-0400) Subject: mon: don't kill MDSs unless some beacons are getting through X-Git-Tag: v12.1.0~130^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a85dd827ef42211cca84e9111e7c4b4c1ae5c2d;p=ceph.git mon: don't kill MDSs unless some beacons are getting through ...to avoid killing MDSs when the MDS is fine, but the mon is failing to process beacons due to a laggy peer. Fixes: http://tracker.ceph.com/issues/19706 Signed-off-by: John Spray --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 575c68ec50b..10c1ca5bbdc 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1888,12 +1888,24 @@ void MDSMonitor::maybe_replace_gid(mds_gid_t gid, << " " << ceph_mds_state_name(info.state) << " since " << beacon.stamp << dendl; + // We will only take decisive action (replacing/removing a daemon) + // if we have some indicating that some other daemon(s) are successfully + // getting beacons through recently. + utime_t latest_beacon; + for (const auto & i : last_beacon) { + latest_beacon = MAX(i.second.stamp, latest_beacon); + } + const bool may_replace = latest_beacon > + (ceph_clock_now() - + MAX(g_conf->mds_beacon_interval, g_conf->mds_beacon_grace * 0.5)); + // are we in? // and is there a non-laggy standby that can take over for us? mds_gid_t sgid; if (info.rank >= 0 && info.state != MDSMap::STATE_STANDBY && info.state != MDSMap::STATE_STANDBY_REPLAY && + may_replace && !pending_fsmap.get_filesystem(fscid)->mds_map.test_flag(CEPH_MDSMAP_DOWN) && (sgid = pending_fsmap.find_replacement_for({fscid, info.rank}, info.name, g_conf->mon_force_standby_active)) != MDS_GID_NONE) @@ -1921,8 +1933,8 @@ void MDSMonitor::maybe_replace_gid(mds_gid_t gid, pending_fsmap.promote(sgid, fs, info.rank); *mds_propose = true; - } else if (info.state == MDSMap::STATE_STANDBY_REPLAY || - info.state == MDSMap::STATE_STANDBY) { + } else if ((info.state == MDSMap::STATE_STANDBY_REPLAY || + info.state == MDSMap::STATE_STANDBY) && may_replace) { dout(10) << " failing and removing " << gid << " " << info.addr << " mds." << info.rank << "." << info.inc << " " << ceph_mds_state_name(info.state) << dendl;