]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: only learn uncommitted value if it is in the future
authorSage Weil <sage@inktank.com>
Sun, 21 Jul 2013 15:11:22 +0000 (08:11 -0700)
committerSage Weil <sage@inktank.com>
Mon, 22 Jul 2013 21:13:24 +0000 (14:13 -0700)
If an older peer sends an uncommitted value, make sure we only take it
if it is in the future, and at least as new as any current uncommitted
value.

(Prior to the previous patch, peers could send values from long-past
rounds.  The pn values are also bogus.)

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Paxos.cc

index 7785d37d4f03bf2fa35034862500c8dacc5d0750..7e39fce37e3fbadb55006d3951d17b5b32f52e42 100644 (file)
@@ -392,7 +392,9 @@ void Paxos::handle_last(MMonPaxos *last)
 
     // did this person send back an accepted but uncommitted value?
     if (last->uncommitted_pn &&
-       last->uncommitted_pn > uncommitted_pn) {
+       last->uncommitted_pn > uncommitted_pn &&
+       last->last_committed >= last_committed &&
+       last->last_committed + 1 >= uncommitted_v) {
       uncommitted_v = last->last_committed+1;
       uncommitted_pn = last->uncommitted_pn;
       uncommitted_value = last->values[uncommitted_v];