]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSMonitor: MDS do not standby replay until other is active
authorSamuel Just <samuel.just@dreamhost.com>
Thu, 31 Mar 2011 23:16:43 +0000 (16:16 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Fri, 1 Apr 2011 21:24:41 +0000 (14:24 -0700)
Previously, an mds could go into standby replay before the mds which it
is replaying has finished creating.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/mds/MDSMap.h
src/mon/MDSMonitor.cc

index 46160f98c1758b26c8c3970dad9a64da7d3cf93e..31713582e441550dc493c2efc6d6ffddb6904899 100644 (file)
@@ -396,6 +396,15 @@ public:
   bool is_stopping(int m) { return get_state(m) == STATE_STOPPING; }
   bool is_clientreplay_or_active_or_stopping(int m)   { return is_clientreplay(m) || is_active(m) || is_stopping(m); }
 
+  bool is_followable(int m) {
+    return (is_resolve(m) ||
+           is_replay(m) ||
+           is_rejoin(m) ||
+           is_clientreplay(m) ||
+           is_active(m) ||
+           is_stopping(m));
+  }
+
   bool is_laggy_gid(uint64_t gid) { return mds_info.count(gid) && mds_info[gid].laggy(); }
 
 
index 3223d6dc61afc8b7c444bf3817c1a95cfd25e8ce..2d52e34e588aa1de8519a50d8d4cbcb7d91ec086 100644 (file)
@@ -355,7 +355,8 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
         info.standby_for_rank =
             mdsmap.find_by_name(info.standby_for_name)->rank;
     }
-    if (info.standby_for_rank >= 0 && !mdsmap.is_dne(info.standby_for_rank)) {
+    if (info.standby_for_rank >= 0 && 
+       mdsmap.is_followable(info.standby_for_rank)) {
       info.state = MDSMap::STATE_STANDBY_REPLAY;
     }
 
@@ -399,7 +400,8 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
                   << " to STANDBY_REPLAY for" << dendl;
         const MDSMap::mds_info_t *found_mds = NULL;
         if ((found_mds = mdsmap.find_by_name(m->get_standby_for_name())) &&
-            (found_mds->rank >= 0)) {
+            (found_mds->rank >= 0) &&
+           mdsmap.is_followable(found_mds->rank)) {
           info.standby_for_rank = found_mds->rank;
           dout(10) <<" found mds " << m->get_standby_for_name()
                        << "; it has rank " << info.standby_for_rank << dendl;
@@ -410,7 +412,7 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
           return false;
         }
       } else if (m->get_standby_for_rank() >= 0 &&
-                 !mdsmap.is_dne(m->get_standby_for_rank())) {
+                mdsmap.is_followable(m->get_standby_for_rank())) {
         /* switch to standby-replay for this MDS*/
         info.state = MDSMap::STATE_STANDBY_REPLAY;
         info.state_seq = seq;
@@ -939,7 +941,8 @@ void MDSMonitor::tick()
         for (map<uint64_t,MDSMap::mds_info_t>::iterator i = pending_mdsmap.mds_info.begin();
             i != pending_mdsmap.mds_info.end();
             ++i) {
-          if (i->second.rank >= 0) {
+          if (i->second.rank >= 0 &&
+             mdsmap.is_followable(i->second.rank)) {
             if ((gid = pending_mdsmap.find_standby_for(
                 i->second.rank, i->second.name))) {
               dout(20) << "checking rank " << i->second.rank << dendl;