From d61ba6441b375f9849714305808a761bee5db14c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 17 Nov 2011 14:11:38 -0800 Subject: [PATCH] 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 --- src/mon/Paxos.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 0a68fb0537b52..437cc393d8b77 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"); } -- 2.39.5