Add 'mds enforce unique name' option, defaulting to true.
If set, when an MDS boots, it will kick any previous mds with the same
name from the mdsmap. This is possibly less confusing for users. If
an mds daemon restarts, it will immediately replace its previous
instantiation.
Two misconfigured daemons running with the same name will fight over
the same role.
Fixes: #3857
Signed-off-by: Sage Weil <sage@inktank.com>
OPTION(mds_decay_halflife, OPT_FLOAT, 5)
OPTION(mds_beacon_interval, OPT_FLOAT, 4)
OPTION(mds_beacon_grace, OPT_FLOAT, 15)
+OPTION(mds_enforce_unique_name, OPT_BOOL, true)
OPTION(mds_blacklist_interval, OPT_FLOAT, 24.0*60.0) // how long to blacklist failed nodes
OPTION(mds_session_timeout, OPT_FLOAT, 60) // cap bits and leases time out if client idle
OPTION(mds_session_autoclose, OPT_FLOAT, 300) // autoclose idle session
assert(up.count(m) && mds_info.count(up[m]));
return mds_info[up[m]];
}
+ uint64_t find_mds_gid_by_name(const string& s) {
+ for (map<uint64_t,mds_info_t>::const_iterator p = mds_info.begin();
+ p != mds_info.end();
+ ++p) {
+ if (p->second.name == s) {
+ return p->first;
+ }
+ }
+ return 0;
+ }
// counts
unsigned get_num_in_mds() {
// boot?
if (state == MDSMap::STATE_BOOT) {
+ // zap previous instance of this name?
+ if (g_conf->mds_enforce_unique_name) {
+ while (uint64_t existing = pending_mdsmap.find_mds_gid_by_name(m->get_name())) {
+ fail_mds_gid(existing);
+ }
+ }
+
// add
MDSMap::mds_info_t& info = pending_mdsmap.mds_info[gid];
info.global_id = gid;
}
}
-
// initialize the beacon timer
last_beacon[gid].stamp = ceph_clock_now(g_ceph_context);
last_beacon[gid].seq = seq;
{
assert(pending_mdsmap.mds_info.count(gid));
MDSMap::mds_info_t& info = pending_mdsmap.mds_info[gid];
+ dout(10) << "fail_mds_gid " << gid << " mds." << info.name << " rank " << info.rank << dendl;
+
utime_t until = ceph_clock_now(g_ceph_context);
until += g_conf->mds_blacklist_interval;