summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-21 08:11:22 -0700
committerSage Weil <sage@inktank.com>2013-07-24 09:01:20 -0700
commitf598245f1355d7791162c03d90bdd97b013e56f3 (patch)
treec810a519b35bddbb74b2a09acea56031d978a115
parent732286a28cd8a643593d490a7a84a590d372f78d (diff)
downloadceph-f598245f1355d7791162c03d90bdd97b013e56f3.tar.gz
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 <sage@inktank.com> (cherry picked from commit b3253a453c057914753846c77499f98d3845c58e)
-rw-r--r--src/mon/Paxos.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc
index b52986cf401..5a9cd841c0e 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];