]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: fix off-by-one in last_ vs first_committed check
authorSage Weil <sage@redhat.com>
Thu, 18 Sep 2014 21:11:24 +0000 (14:11 -0700)
committerSage Weil <sage@redhat.com>
Mon, 27 Oct 2014 03:45:04 +0000 (20:45 -0700)
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 <sage@redhat.com>
(cherry picked from commit d81cd7f86695185dce31df76c33c9a02123f0e4a)

src/mon/Paxos.cc

index ef745ff088f562e500b7a608041542a7610bad23..85cfb4f2f5d3d12adb2f24c1c59aade48b7e7527 100644 (file)
@@ -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<int,version_t>::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