]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make osd mark itself back up if it is marked down
authorSage Weil <sage@newdream.net>
Tue, 28 Apr 2009 23:30:12 +0000 (16:30 -0700)
committerSage Weil <sage@newdream.net>
Tue, 28 Apr 2009 23:30:12 +0000 (16:30 -0700)
We may still want a way to tell an osd to exit.

src/osd/OSD.cc
src/osd/OSD.h

index 3e3b0ce672f3ffce7eec86c332e85af68d70b8ee..aa7968c2d3abc1b7f0283de61153990f69f57364 100644 (file)
@@ -223,8 +223,7 @@ OSD::OSD(int id, Messenger *m, Messenger *hbm, MonMap *mm, const char *dev, cons
   logclient(messenger, monmap),
   whoami(id),
   dev_path(dev), journal_path(jdev),
-  boot_epoch(0), last_active_epoch(0),
-  state(STATE_BOOTING),
+  state(STATE_BOOTING), boot_epoch(0),
   op_tp("OSD::op_tp", g_conf.osd_maxthreads),
   recovery_tp("OSD::recovery_tp", 1),
   disk_tp("OSD::disk_tp", 2),
@@ -1896,6 +1895,21 @@ void OSD::handle_osd_map(MOSDMap *m)
       pg->write_log(t);
   }
 
+  if (osdmap->get_epoch() > 0 &&
+      (!osdmap->exists(whoami) || 
+       (!osdmap->is_up(whoami) && osdmap->get_addr(whoami) == messenger->get_myaddr()))) {
+    dout(0) << "map says i am down.  switching to boot state." << dendl;
+    //shutdown();
+
+    // note in the superblock that we were clean up until this point.
+    superblock.epoch_mounted = boot_epoch;
+    superblock.epoch_unmounted = osdmap->get_epoch();
+
+    state = STATE_BOOTING;
+    boot_epoch = 0;
+  }
+
+
   // superblock and commit
   write_superblock(t);
   store->apply_transaction(t);
@@ -1911,12 +1925,6 @@ void OSD::handle_osd_map(MOSDMap *m)
 
   delete m;
 
-  if (osdmap->get_epoch() > 0 &&
-      (!osdmap->exists(whoami) || 
-       (!osdmap->is_up(whoami) && osdmap->get_addr(whoami) == messenger->get_myaddr()))) {
-    dout(0) << "map says i am dead" << dendl;
-    shutdown();
-  }
 }
 
 
@@ -2158,8 +2166,6 @@ void OSD::activate_map(ObjectStore::Transaction& t)
     pg->unlock();
   }  
 
-  last_active_epoch = osdmap->get_epoch();
-
   do_notifies(notify_list);  // notify? (residual|replica)
   do_queries(query_map);
   do_infos(info_map);
index aa0d4b7d0752b2b8bcedd3da2d5861133c57afb1..8081907de6986e814335d860cf93ee9ba57bbdac 100644 (file)
@@ -129,8 +129,6 @@ public:
 private:
   // -- superblock --
   OSDSuperblock superblock;
-  epoch_t boot_epoch;      
-  epoch_t last_active_epoch;
 
   void write_superblock();
   void write_superblock(ObjectStore::Transaction& t);
@@ -145,6 +143,7 @@ public:
 
 private:
   int state;
+  epoch_t boot_epoch;      
 
 public:
   bool is_booting() { return state == STATE_BOOTING; }