]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: set snap epoch for poolsnap removal, too
authorSage Weil <sage@newdream.net>
Thu, 25 Jun 2009 03:13:08 +0000 (20:13 -0700)
committerSage Weil <sage@newdream.net>
Thu, 25 Jun 2009 03:13:08 +0000 (20:13 -0700)
src/mon/OSDMonitor.cc

index 5ffb331c57b231d5f8c168644aa8fd6b689d429a..122d7d314469c0a32b62e8192ccaa7ed51070d23 100644 (file)
@@ -1296,21 +1296,23 @@ bool OSDMonitor::preprocess_pool_snap ( MPoolSnap *m) {
   return false;
 }
 
-bool OSDMonitor::prepare_pool_snap ( MPoolSnap *m)
+bool OSDMonitor::prepare_pool_snap (MPoolSnap *m)
 {
   const pg_pool_t *p = &osdmap.get_pg_pool(m->pool);
   pg_pool_t* pp = 0;
   //if the pool isn't already in the update, add it
-  if (!pending_inc.new_pools.count(m->pool)) pending_inc.new_pools[m->pool] = *p;
+  if (!pending_inc.new_pools.count(m->pool))
+    pending_inc.new_pools[m->pool] = *p;
   pp = &pending_inc.new_pools[m->pool];
 
-  if (m->create) { //it's a snap creation message
+  if (m->create) {
     pp->add_snap(m->name.c_str(), g_clock.now());
-    pp->set_snap_epoch(pending_inc.epoch);
-  }
-  else { //it's a snap removal message
+    dout(10) << "create snap in pool " << m->pool << " " << m->name << " seq " << pp->get_snap_epoch() << dendl;
+  } else {
     pp->remove_snap(pp->snap_exists(m->name.c_str()));
   }
+  pp->set_snap_epoch(pending_inc.epoch);
+
   paxos->wait_for_commit(new OSDMonitor::C_Snap(this, m, 0, pending_inc.epoch));
   return true;
 }