From 92d2a38efd458f9e8f4da228ea1e94df08dc8222 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 18 Sep 2014 14:11:24 -0700 Subject: [PATCH] mon/Paxos: fix off-by-one in last_ vs first_committed check peon last_committed + 1 == leader first_committed is okay. Note that the other check (where I clean up whitespace) gets this correct. Fixes: #9301 (partly) Signed-off-by: Sage Weil (cherry picked from commit d81cd7f86695185dce31df76c33c9a02123f0e4a) --- src/mon/Paxos.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index ef745ff088f56..85cfb4f2f5d3d 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -465,7 +465,7 @@ void Paxos::handle_last(MMonPaxos *last) peer_first_committed[from] = last->first_committed; peer_last_committed[from] = last->last_committed; - if (last->first_committed > last_committed+1) { + if (last->first_committed > last_committed + 1) { dout(5) << __func__ << " mon." << from << " lowest version is too high for our last committed" @@ -487,7 +487,7 @@ void Paxos::handle_last(MMonPaxos *last) for (map::iterator p = peer_last_committed.begin(); p != peer_last_committed.end(); ++p) { - if (p->second < first_committed && first_committed > 1) { + if (p->second + 1 < first_committed && first_committed > 1) { dout(5) << __func__ << " peon " << p->first << " last_committed (" << p->second -- 2.39.5