]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
paxos: fix trimming when we skip over incrementals
authorSage Weil <sage@newdream.net>
Thu, 17 Nov 2011 22:11:38 +0000 (14:11 -0800)
committerSage Weil <sage@newdream.net>
Thu, 17 Nov 2011 22:11:38 +0000 (14:11 -0800)
Remove open-coded trimming of old states and use our method (that also
removes additional per-state files).  Fixes old stray state files.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/Paxos.cc

index 0a68fb0537b5224f167e382cf3191a0ffc5d3c62..437cc393d8b77345124cf6203f5c04b42955522c 100644 (file)
@@ -188,15 +188,14 @@ void Paxos::store_state(MMonPaxos *m)
   // stash?
   if (m->latest_version && m->latest_version > last_committed) {
     dout(10) << "store_state got stash version " << m->latest_version << ", zapping old states" << dendl;
+
+    // wipe out everything we had previously
+    trim_to(last_committed + 1);
+
     stash_latest(m->latest_version, m->latest_value);
 
-    while (first_committed <= last_committed) {
-      dout(10) << "store_state trim " << first_committed << dendl;
-      mon->store->erase_sn(machine_name, first_committed);
-      first_committed++;
-    }
+    first_committed = m->latest_version;
     last_committed = m->latest_version;
-    first_committed = last_committed;
     mon->store->put_int(first_committed, machine_name, "first_committed");
     mon->store->put_int(last_committed, machine_name, "last_committed");
   }