]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: never write first_committed except during trim
authorSage Weil <sage@inktank.com>
Tue, 25 Jun 2013 22:43:33 +0000 (15:43 -0700)
committerSage Weil <sage@inktank.com>
Wed, 26 Jun 2013 04:25:04 +0000 (21:25 -0700)
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 <sage@inktank.com>
src/mon/Paxos.cc

index 4ccf52635ad1a6cefdf52547329a7ee2a341b442..77baef405035b0f11166c41f1c676478ed58be64 100644 (file)
@@ -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<version_t,bufferlist>::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.