]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: use 'latest' for latest osd, mds maps
authorSage Weil <sage@newdream.net>
Tue, 9 Dec 2008 22:55:00 +0000 (14:55 -0800)
committerSage Weil <sage@newdream.net>
Tue, 9 Dec 2008 22:55:00 +0000 (14:55 -0800)
Mainly for benefit of PaxosObserver, but it also cleans things up
a bit.

src/mon/MDSMonitor.cc
src/mon/OSDMonitor.cc
src/mon/mon_types.h

index 4a75dc1fef4e9ef8118f0ae8c5b16d2a6be7f7be..99e69203d7b79bbbeb6e4ad49793acd5a4029642 100644 (file)
@@ -84,6 +84,9 @@ bool MDSMonitor::update_from_paxos()
   dout(10) << "update_from_paxos  got " << paxosv << dendl;
   mdsmap.decode(mdsmap_bl);
 
+  // save as 'latest', too.
+  paxos->stash_latest(paxosv, mdsmap_bl);
+
   // new map
   dout(4) << "new map" << dendl;
   print_map(mdsmap, 0);
index 25b03bf9c65463940d6abc676dde7443a5e2a2d5..9a4f37e0cfd5a70df76db699f75acdb7e344064b 100644 (file)
@@ -138,18 +138,17 @@ bool OSDMonitor::update_from_paxos()
 
   if (osdmap.epoch == 0 && paxosv > 1) {
     // startup: just load latest full map
-    epoch_t lastfull = mon->store->get_int("osdmap_full","last_epoch");
-    if (lastfull) {
-      dout(7) << "update_from_paxos startup: loading latest full map e" << lastfull << dendl;
-      bufferlist bl;
-      mon->store->get_bl_sn(bl, "osdmap_full", lastfull);
-      osdmap.decode(bl);
+    bufferlist latest;
+    version_t v = paxos->get_latest(latest);
+    if (v) {
+      dout(7) << "update_from_paxos startup: loading latest full map e" << v << dendl;
+      osdmap.decode(latest);
     }
   } 
   
   // walk through incrementals
+  bufferlist bl;
   while (paxosv > osdmap.epoch) {
-    bufferlist bl;
     bool success = paxos->read(osdmap.epoch+1, bl);
     assert(success);
     
@@ -157,7 +156,7 @@ bool OSDMonitor::update_from_paxos()
     OSDMap::Incremental inc(bl);
     osdmap.apply_incremental(inc);
 
-    // write out the full map, too.
+    // write out the full map for all past epochs
     bl.clear();
     osdmap.encode(bl);
     mon->store->put_bl_sn(bl, "osdmap_full", osdmap.epoch);
@@ -165,7 +164,9 @@ bool OSDMonitor::update_from_paxos()
     // share
     dout(1) << osdmap << dendl;
   }
-  mon->store->put_int(osdmap.epoch, "osdmap_full","last_epoch");
+
+  // save latest
+  paxos->stash_latest(paxosv, bl);
 
   if (mon->is_leader()) {
     // kick pgmon, make sure it's seen the latest map
index 34315d261426f5b16e00d233bee20565daa867fd..f404fa1b098498b1a96548ec6d596ae7831cc021 100644 (file)
@@ -33,6 +33,6 @@ inline const char *get_paxos_name(int p) {
   }
 }
 
-#define CEPH_MON_ONDISK_MAGIC "ceph mon volume v006"
+#define CEPH_MON_ONDISK_MAGIC "ceph mon volume v007"
 
 #endif