]> 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>
Thu, 16 Oct 2014 00:17:35 +0000 (17:17 -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 4e7ff50312db403d4814a0a10e9328262533e8a3..2e41eb80fe1ee993868069af66b6b4f3ce6f6342 100644 (file)
@@ -464,7 +464,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"
@@ -486,7 +486,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