diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 6ecee035c8c..6e3c42194c8 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -911,7 +911,7 @@ void MDSDaemon::handle_mds_map(MMDSMap *m) // Did I previously not hold a rank? Initialize! if (mds_rank == NULL) { - mds_rank = new MDSRankDispatcher(whoami, incarnation, mds_lock, clog, + mds_rank = new MDSRankDispatcher(whoami, mds_lock, clog, timer, beacon, mdsmap, messenger, monc, objecter, new C_VoidFn(this, &MDSDaemon::respawn), new C_VoidFn(this, &MDSDaemon::suicide)); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 8c04b2f3fde..0bc0f8413af 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -40,7 +40,6 @@ MDSRank::MDSRank( mds_rank_t whoami_, - int incarnation_, Mutex &mds_lock_, LogChannelRef &clog_, SafeTimer &timer_, @@ -52,8 +51,7 @@ MDSRank::MDSRank( Context *respawn_hook_, Context *suicide_hook_) : - whoami(whoami_), - incarnation(incarnation_), + whoami(whoami_), incarnation(0), mds_lock(mds_lock_), clog(clog_), timer(timer_), mdsmap(mdsmap_), objecter(objecter_), @@ -1369,10 +1367,11 @@ void MDSRankDispatcher::handle_mds_map( assert(whoami != MDS_RANK_NONE); MDSMap::DaemonState oldstate = state; - state = mdsmap->get_state_gid(mds_gid_t( - monc->get_global_id())); + mds_gid_t mds_gid = mds_gid_t(monc->get_global_id()); + state = mdsmap->get_state_gid(mds_gid); if (state != oldstate) { last_state = oldstate; + incarnation = mdsmap->get_inc_gid(mds_gid); } version_t epoch = m->get_epoch(); @@ -1417,9 +1416,9 @@ void MDSRankDispatcher::handle_mds_map( if (oldstate != state) { // update messenger. if (state == MDSMap::STATE_STANDBY_REPLAY || state == MDSMap::STATE_ONESHOT_REPLAY) { - dout(1) << "handle_mds_map i am now mds." << monc->get_global_id() << "." << incarnation - << "replaying mds." << whoami << "." << incarnation << dendl; - messenger->set_myname(entity_name_t::MDS(monc->get_global_id())); + dout(1) << "handle_mds_map i am now mds." << mds_gid << "." << incarnation + << " replaying mds." << whoami << "." << incarnation << dendl; + messenger->set_myname(entity_name_t::MDS(mds_gid)); } else { dout(1) << "handle_mds_map i am now mds." << whoami << "." << incarnation << dendl; messenger->set_myname(entity_name_t::MDS(whoami)); @@ -2370,7 +2369,6 @@ bool MDSRankDispatcher::handle_command_legacy(std::vector args) MDSRankDispatcher::MDSRankDispatcher( mds_rank_t whoami_, - int incarnation_, Mutex &mds_lock_, LogChannelRef &clog_, SafeTimer &timer_, @@ -2381,7 +2379,7 @@ MDSRankDispatcher::MDSRankDispatcher( Objecter *objecter_, Context *respawn_hook_, Context *suicide_hook_) - : MDSRank(whoami_, incarnation_, mds_lock_, clog_, timer_, beacon_, mdsmap_, + : MDSRank(whoami_, mds_lock_, clog_, timer_, beacon_, mdsmap_, msgr, monc_, objecter_, respawn_hook_, suicide_hook_) {} diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index fda2dfa4605..b999657a0ad 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -119,7 +119,7 @@ class MDSRank { // Incarnation as seen in MDSMap at the point where a rank is // assigned. - const int incarnation; + int incarnation; public: mds_rank_t get_nodeid() const { return whoami; } @@ -265,7 +265,6 @@ class MDSRank { MDSRank( mds_rank_t whoami_, - int incarnation_, Mutex &mds_lock_, LogChannelRef &clog_, SafeTimer &timer_, @@ -496,7 +495,6 @@ public: MDSRankDispatcher( mds_rank_t whoami_, - int incarnation_, Mutex &mds_lock_, LogChannelRef &clog_, SafeTimer &timer_,