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-22 14:13:24 -0700
commitb3253a453c057914753846c77499f98d3845c58e (patch)
tree6c18ce6db05bb44e5544e76500864fdb32b5932c
parentb26b7f6e5e02ac6beb66e3e34e177e6448cf91cf (diff)
downloadceph-b3253a453c057914753846c77499f98d3845c58e.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>
-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 7785d37d4f0..7e39fce37e3 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];