summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-11-17 14:11:38 -0800
committerSage Weil <sage@newdream.net>2011-11-17 14:11:38 -0800
commitd61ba6441b375f9849714305808a761bee5db14c (patch)
tree870153dc094d9dda67fc14535fb5c1997d1b4ee8
parent367ab142d7bc938c5a8b40027acd2431a11c8022 (diff)
downloadceph-d61ba6441b375f9849714305808a761bee5db14c.tar.gz
paxos: fix trimming when we skip over incrementals
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>
-rw-r--r--src/mon/Paxos.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc
index 0a68fb0537b..437cc393d8b 100644
--- a/src/mon/Paxos.cc
+++ b/src/mon/Paxos.cc
@@ -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");
}