]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix mds stopping and restart
authorSage Weil <sage@newdream.net>
Sat, 4 Apr 2009 21:18:47 +0000 (14:18 -0700)
committerSage Weil <sage@newdream.net>
Sat, 4 Apr 2009 21:29:50 +0000 (14:29 -0700)
Remove stopped mds from last_beacon (monitoring) set.  Fix mdsmap dump
output to include stopping set.  Remove mds from stopped set on start.

src/mds/MDSMap.cc
src/mon/MDSMonitor.cc

index 4ffa030ea4b7c3219b972f2cab62f576b98b110f..aefbfe4a718d2ed6b6c41a658644948314fde944 100644 (file)
@@ -33,8 +33,10 @@ void MDSMap::print(ostream& out)
 
   set<int> upset;
   get_up_mds_set(upset);
-  out << "in " << in << "\n"
-      << "up " << upset << "\n";
+  out << "in <" << in << ">\n"
+      << "up <" << upset << ">\n"
+      << "failed <" << failed << ">\n"
+      << "stopped <" << stopped << ">\n";
 
   multimap< pair<unsigned,unsigned>, entity_addr_t > foo;
   for (map<entity_addr_t,mds_info_t>::iterator p = mds_info.begin();
@@ -67,10 +69,6 @@ void MDSMap::print(ostream& out)
     out << "\n";    
   }
 
-  if (failed.size())
-    out << "failed " << failed << "\n";
-  if (stopped.size())
-    out << "stopped " << failed << "\n";
 }
 
 
@@ -94,4 +92,6 @@ void MDSMap::print_summary(ostream& out)
   
   if (failed.size())
     out << ", " << failed.size() << " failed";
+  if (stopped.size())
+    out << ", " << stopped.size() << " stopped";
 }
index 9cd2a21b7a2190a087d54ca9483f47e5f74a8de3..472ecbcd21d9eb72480edb0b11ec89dbfeffec81 100644 (file)
@@ -304,9 +304,10 @@ bool MDSMonitor::prepare_beacon(MMDSBeacon *m)
             << dendl;
     if (state == MDSMap::STATE_STOPPED) {
       pending_mdsmap.up.erase(info.rank);
-      pending_mdsmap.mds_info.erase(addr);
-      pending_mdsmap.stopped.insert(info.rank);
       pending_mdsmap.in.erase(info.rank);
+      pending_mdsmap.stopped.insert(info.rank);
+      pending_mdsmap.mds_info.erase(addr);  // last! info is a ref into this map
+      last_beacon.erase(addr);
     } else {
       info.state = state;
       info.state_seq = seq;
@@ -544,9 +545,10 @@ void MDSMonitor::tick()
     
     MDSMap::mds_info_t& info = pending_mdsmap.mds_info[addr];
     info.rank = mds;
-    if (pending_mdsmap.stopped.count(mds))
+    if (pending_mdsmap.stopped.count(mds)) {
       info.state = MDSMap::STATE_STARTING;
-    else
+      pending_mdsmap.stopped.erase(mds);
+    } else
       info.state = MDSMap::STATE_CREATING;
     info.inc = ++pending_mdsmap.inc[mds];
     pending_mdsmap.in.insert(mds);