From: Sage Weil Date: Tue, 25 Jun 2013 22:58:43 +0000 (-0700) Subject: mon/Paxos: update first_committed only from paxos X-Git-Tag: v0.67-rc1~175^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2f38118140d6334b581f422cfb22fc3d820e0bd;p=ceph.git mon/Paxos: update first_committed only from paxos Do not touch the in-memory first_committed until the trim commits. This avoids any possible confusion due to races and keeps commit() as similar to store_state() as possible. Similarly, do not touch first_committed from store_state. We should *only* pull it out of the kv store. Signed-off-by: Sage Weil --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index bbb488684c4..a952da30171 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -291,8 +291,6 @@ void Paxos::store_state(MMonPaxos *m) map::iterator end = start; while (end != m->values.end() && end->first <= m->last_committed) { last_committed = end->first; - if (!first_committed) - first_committed = last_committed; ++end; } @@ -677,6 +675,9 @@ void Paxos::commit() 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(); // tell everyone @@ -974,7 +975,6 @@ void Paxos::trim_to(MonitorDBStore::Transaction *t, version_t first) return; trim_to(t, first_committed, first); t->put(get_name(), "first_committed", first); - first_committed = first; } void Paxos::trim_to(version_t first)