]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mdsmon: Fix handling of follow-by-name MDSes.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 28 Jul 2011 00:42:24 +0000 (17:42 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 28 Jul 2011 00:42:31 +0000 (17:42 -0700)
We were accidentally setting them to standby-for-rank -1 if their
leader MDS wasn't active on startup. Things worked out in the end
anyway since they would go from standby to active for the appropriate
rank, but we want them to be in proper standby-replay!

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mon/MDSMonitor.cc

index d08b3ff2d2a652172c3c0bd3943090af3102616a..bfd94860e29501b3f44975c6a3294faf7707c4cc 100644 (file)
@@ -349,14 +349,16 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
     info.standby_for_name = m->get_standby_for_name();
 
     if (!info.standby_for_name.empty()) {
-      if (mdsmap.find_by_name(info.standby_for_name))
+      const MDSMap::mds_info_t *leaderinfo = mdsmap.find_by_name(info.standby_for_name);
+      if (leaderinfo && (leaderinfo->rank >= 0)) {
         info.standby_for_rank =
             mdsmap.find_by_name(info.standby_for_name)->rank;
+        if (mdsmap.is_followable(info.standby_for_rank)) {
+          info.state = MDSMap::STATE_STANDBY_REPLAY;
+        }
+      }
     }
-    if (info.standby_for_rank >= 0 && 
-       mdsmap.is_followable(info.standby_for_rank)) {
-      info.state = MDSMap::STATE_STANDBY_REPLAY;
-    }
+
 
     // initialize the beacon timer
     last_beacon[gid].stamp = ceph_clock_now(g_ceph_context);