From: Sage Weil Date: Thu, 18 Sep 2014 21:11:24 +0000 (-0700) Subject: mon/Paxos: fix off-by-one in last_ vs first_committed check X-Git-Tag: v0.88~164^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d81cd7f86695185dce31df76c33c9a02123f0e4a;p=ceph.git 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 --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index ef745ff088f..85cfb4f2f5d 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