Skip to content

Commit

Permalink
mds: gracefully exit if newer gid replaces us by name
Browse files Browse the repository at this point in the history
If 'mds enforce unique name' is set, and another MDS with the same name
kicks us out of the MDSMap, gracefully exit instead of respawning and
fighting over our position.

Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Sage Weil committed Jan 18, 2013
1 parent 2e11233 commit dd7caf5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/mds/MDS.cc
Expand Up @@ -903,6 +903,20 @@ void MDS::handle_mds_map(MMDSMap *m)
if (want_state == MDSMap::STATE_BOOT) {
dout(10) << "not in map yet" << dendl;
} else {
// did i get kicked by someone else?
if (g_conf->mds_enforce_unique_name) {
if (uint64_t existing = mdsmap->find_mds_gid_by_name(name)) {
MDSMap::mds_info_t& i = mdsmap->get_info_gid(existing);
if (i.global_id > monc->get_global_id()) {
dout(1) << "handle_mds_map i (" << addr
<< ") dne in the mdsmap, new instance has larger gid " << i.global_id
<< ", suicide" << dendl;
suicide();
goto out;
}
}
}

dout(1) << "handle_mds_map i (" << addr
<< ") dne in the mdsmap, respawning myself" << dendl;
respawn();
Expand Down

0 comments on commit dd7caf5

Please sign in to comment.