]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos[Service]: allow reads during WRITING state
authorSage Weil <sage@redhat.com>
Tue, 19 Aug 2014 23:45:46 +0000 (16:45 -0700)
committerSage Weil <sage@redhat.com>
Wed, 27 Aug 2014 21:36:08 +0000 (14:36 -0700)
The REFRESH state is not readable; that's when we are re-reading our state
out of leveldb, and we hold the mon_lock during the period.  So, strictly
speaking, it doesn't matter whether we include it here since none of these
call sites would be visited while in that state.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/Paxos.cc
src/mon/PaxosService.h

index 5c0ce2faa2a08e67b2bdc48d403ad4361d605e70..4ffbb48812413e8c23e79665cf9b6c4b76ec5690 100644 (file)
@@ -796,7 +796,7 @@ void Paxos::accept_timeout()
   dout(1) << "accept timeout, calling fresh election" << dendl;
   accept_timeout_event = 0;
   assert(mon->is_leader());
-  assert(is_updating() || is_updating_previous());
+  assert(is_updating() || is_updating_previous() || is_writing());
   logger->inc(l_paxos_accept_timeout);
   mon->bootstrap();
 }
@@ -1396,7 +1396,7 @@ bool Paxos::is_readable(version_t v)
     return false;
   return 
     (mon->is_peon() || mon->is_leader()) &&
-    (is_active() || is_updating()) &&
+    (is_active() || is_updating() || is_writing()) &&
     last_committed > 0 &&           // must have a value
     (mon->get_quorum().size() == 1 ||  // alone, or
      is_lease_valid()); // have lease
index 3acdf65ffda51083cd000f0121fa86590d5d3708..e6c5a02ec9ebe7ead8020cfc6873acb90b66dbba 100644 (file)
@@ -549,7 +549,7 @@ public:
   bool is_active() {
     return
       !is_proposing() &&
-      (paxos->is_active() || paxos->is_updating());
+      (paxos->is_active() || paxos->is_updating() || paxos->is_writing());
   }
 
   /**
@@ -580,7 +580,7 @@ public:
    *
    *  - we are not proposing a new version;
    *  - we are ready to be written to -- i.e., we have a pending value.
-   *  - paxos is (active or updating)
+   *  - paxos is (active or updating or writing or refresh)
    *
    * @returns true if writeable; false otherwise
    */
@@ -588,7 +588,7 @@ public:
     return
       !is_proposing() &&
       is_write_ready() &&
-      (paxos->is_active() || paxos->is_updating());
+      (paxos->is_active() || paxos->is_updating() || paxos->is_writing());
   }
 
   /**