summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-06 15:20:05 -0700
committerSage Weil <sage@inktank.com>2013-06-24 16:16:41 -0700
commit9d7c40e3f4ea2dd969aa0264ea8a6ad74f3e678a (patch)
tree42c338e6aa75b8293921e937ed8fd6adb4d164e1
parent35745cba8985c5f3238e3c28fd28b194fae043d9 (diff)
downloadceph-9d7c40e3f4ea2dd969aa0264ea8a6ad74f3e678a.tar.gz
mon/PaxosService: simplify is_writeable
Recast this in terms of paxos check + our conditions, and make it match wait_for_writeable(). Signed-off-by: Sage Weil <sage@inktank.com> (cherry picked from commit f985de28f86675e974ac7842a49922a35fe24c6c)
-rw-r--r--src/mon/PaxosService.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h
index decd046f633..c3d97ebb98c 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -545,19 +545,16 @@ public:
* We consider to be writeable iff:
*
* - we are not proposing a new version;
- * - our monitor is the leader;
- * - we have a valid lease;
- * - Paxos is not boostrapping.
- * - Paxos is not recovering.
* - we are ready to be written to -- i.e., we have a pending value.
+ * - paxos is writeable
*
* @returns true if writeable; false otherwise
*/
bool is_writeable() {
- return (is_active()
- && mon->is_leader()
- && paxos->is_lease_valid()
- && is_write_ready());
+ return
+ !is_proposing() &&
+ is_write_ready() &&
+ paxos->is_writeable();
}
/**
@@ -621,12 +618,12 @@ public:
* @param c The callback to be awaken once we become writeable.
*/
void wait_for_writeable(Context *c) {
- if (!is_proposing()) {
+ if (is_proposing())
+ wait_for_finished_proposal(c);
+ else if (!is_write_ready())
+ wait_for_active(c);
+ else
paxos->wait_for_writeable(c);
- return;
- }
-
- wait_for_finished_proposal(c);
}
/**