]> git-server-git.apps.pok.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>
Wed, 24 Jul 2013 16:01:20 +0000 (09:01 -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>
(cherry picked from commit b3253a453c057914753846c77499f98d3845c58e)

src/mon/Paxos.cc

index b52986cf401c64b32f660a1944af445b0494a801..5a9cd841c0e12c8157a9b70d3d012f51d2cb6b0a 100644 (file)
@@ -393,7 +393,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];