]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PaxosService: is_writeable() depends on being ready to be written to
authorJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 16 Apr 2013 15:41:18 +0000 (16:41 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 22 Apr 2013 22:20:21 +0000 (23:20 +0100)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PaxosService.h

index e8cd214783cb6351f0491b458a1bd9fa0f2039ee..cd112e10fed1f66786d29210d00708cb4de3be78 100644 (file)
@@ -503,13 +503,25 @@ public:
    *  - 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.
    *
    * @returns true if writeable; false otherwise
    */
   bool is_writeable() {
     return (is_active()
         && mon->is_leader()
-        && paxos->is_lease_valid());
+        && paxos->is_lease_valid()
+        && is_write_ready());
+  }
+
+  /**
+   * Check if we are ready to be written to.  This means we must have a
+   * pending value and be active.
+   *
+   * @returns true if we are ready to be written to; false otherwise.
+   */
+  bool is_write_ready() {
+    return is_active() && have_pending;
   }
 
   /**