mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
mds: adjust MDSRank::incarnation according to mdsmap
When a standby-replay MDS replace failed MDS, we need update its incarnation. Fixes: #13166 Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
c4b2d12ad5
commit
e65fb1ba70
@ -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));
|
||||
|
@ -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<std::string> 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_)
|
||||
{}
|
||||
|
||||
|
@ -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_,
|
||||
|
Loading…
Reference in New Issue
Block a user