From f598245f1355d7791162c03d90bdd97b013e56f3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 21 Jul 2013 08:11:22 -0700 Subject: [PATCH] mon/Paxos: only learn uncommitted value if it is in the future 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 (cherry picked from commit b3253a453c057914753846c77499f98d3845c58e) --- src/mon/Paxos.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index b52986cf401c6..5a9cd841c0e12 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -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]; -- 2.39.5