diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-04-19 12:56:51 +0100 |
---|---|---|
committer | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-04-22 15:14:28 +0100 |
commit | 954a3c91ed804df7377d6bec134fdbd9620cf416 (patch) | |
tree | 8fac94bb2d700becd988bda5dcfc5271a355e2f5 | |
parent | 291a86ed9082bf1469e84a45374b2b86f3578f21 (diff) | |
download | ceph-954a3c91ed804df7377d6bec134fdbd9620cf416.tar.gz |
mon: PaxosService: is_readable/writeable() depending on is_active()
Instead of depending on individual conditions.
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rw-r--r-- | src/mon/PaxosService.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 31ec1eea999..e8cd214783c 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -485,7 +485,7 @@ public: bool is_readable(version_t ver = 0) { if ((ver > get_last_committed()) || ((!mon->is_peon() && !mon->is_leader())) - || (is_proposing() || paxos->is_recovering() || paxos->is_locked()) + || !is_active() || (get_last_committed() <= 0) || ((mon->get_quorum().size() != 1) && !paxos->is_lease_valid())) { return false; @@ -507,10 +507,9 @@ public: * @returns true if writeable; false otherwise */ bool is_writeable() { - return (!is_proposing() && mon->is_leader() - && !paxos->is_locked() - && paxos->is_lease_valid() && !paxos->is_bootstrapping() - && !paxos->is_recovering()); + return (is_active() + && mon->is_leader() + && paxos->is_lease_valid()); } /** |