From b3253a453c057914753846c77499f98d3845c58e 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 --- 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 7785d37d4f03b..7e39fce37e3fb 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -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]; -- 2.39.5