]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSMonitor: Try to assign unassigned standby-replay MDSes during tick()
authorGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 20 Jan 2011 21:37:00 +0000 (13:37 -0800)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 24 Jan 2011 18:57:51 +0000 (10:57 -0800)
We can now specify an MDS as standby-replay and let the monitor
assign it to any MDS. The monitor will only assign it to an
MDS that doesn't already have a hot standby, though.

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

index 7ececa331519cc77b7950115fc52890f8e6ddc6f..3e4efb40d411d971f029ce9c15fba8a23d7e3911 100644 (file)
@@ -830,11 +830,33 @@ void MDSMonitor::tick()
        continue;
       }
 
-      if (since >= cutoff)
+      if (since >= cutoff && pending_mdsmap.mds_info[gid].standby_for_rank != -2)
        continue;
 
+
       MDSMap::mds_info_t& info = pending_mdsmap.mds_info[gid];
 
+      if (since >= cutoff && info.standby_for_rank == -2) {
+        /* this mds is not laggy, but has no rank assigned.
+         * See if we can find it somebody to shadow
+         */
+        int gid = 0;
+        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 &&
+              (gid = pending_mdsmap.find_standby_for(i->first, i->second.name)))
+            if (pending_mdsmap.get_info_gid(gid).state == MDSMap::STATE_STANDBY_REPLAY)
+              continue; // this MDS already has a standby
+          // hey, we found an MDS without a standby. Pair them!
+          info.standby_for_rank = i->second.rank;
+          dout(10) << "setting to shadow mds rank " << info.standby_for_rank << dendl;
+          info.state = MDSMap::STATE_STANDBY_REPLAY;
+          do_propose = true;
+          break;
+        }
+        continue;
+      }
       dout(10) << "no beacon from " << info.addr << " mds" << info.rank << "." << info.inc
               << " " << ceph_mds_state_name(info.state)
               << " since " << since << dendl;