From: Sage Weil Date: Tue, 19 Aug 2014 23:45:46 +0000 (-0700) Subject: mon/Paxos[Service]: allow reads during WRITING state X-Git-Tag: v0.86~190^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3dcea3b783c4de9a5204f0d091b9622ea9684914;p=ceph.git mon/Paxos[Service]: allow reads during WRITING state 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 --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 5c0ce2faa2a0..4ffbb4881241 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -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 diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 3acdf65ffda5..e6c5a02ec9eb 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -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()); } /**