From: Sage Weil Date: Tue, 25 Jun 2013 22:43:33 +0000 (-0700) Subject: mon/Paxos: never write first_committed except during trim X-Git-Tag: v0.67-rc1~175^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fe365339b9ff2d45be6c41aa66646ae3d80e5715;p=ceph.git mon/Paxos: never write first_committed except during trim The trimming is handled by proposing transactions. Do not confuse matters by writing (incorrect) first_committed values at any other point. Signed-off-by: Sage Weil --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 4ccf52635ad1..77baef405035 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -302,11 +302,6 @@ void Paxos::store_state(MMonPaxos *m) dout(10) << "store_state [" << start->first << ".." << last_committed << "]" << dendl; t.put(get_name(), "last_committed", last_committed); - // we write our first_committed version before we append the message's - // transaction because this transaction may be a trim; if so, it will - // update the first_committed value, and we must let it clobber our own - // in order to obtain an updated state. - t.put(get_name(), "first_committed", first_committed); // we should apply the state here -- decode every single bufferlist in the // map and append the transactions to 't'. map::iterator it; @@ -327,6 +322,9 @@ void Paxos::store_state(MMonPaxos *m) get_store()->apply_transaction(t); + // refresh first_committed; this txn may have trimmed. + first_committed = get_store()->get(get_name(), "first_committed"); + _sanity_check_store(); } @@ -662,10 +660,6 @@ void Paxos::commit() last_committed++; last_commit_time = ceph_clock_now(g_ceph_context); t.put(get_name(), "last_committed", last_committed); - if (!first_committed) { - first_committed = last_committed; - t.put(get_name(), "first_committed", last_committed); - } // decode the value and apply its transaction to the store. // this value can now be read from last_committed.