]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: prevent reads until initial service commit is done
authorSage Weil <sage@inktank.com>
Mon, 8 Jul 2013 17:49:28 +0000 (10:49 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 05:17:41 +0000 (22:17 -0700)
Do not process reads (or, by PaxosService::dispatch() implication, writes)
until we have committed the initial service state.  This avoids things like
EPERM due to missing keys when we race with mon creation, triggered by
teuthology tests doing their health check after startup.

Fixes: #5515
Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PaxosService.h

index 3e5c69fb22fe33489f596a50698c97a529ff6302..3b4c3acca13f19b372d4263c215c3248af414cfa 100644 (file)
@@ -548,6 +548,7 @@ public:
    *
    *  - the client hasn't seen the future relative to this PaxosService
    *  - this service isn't proposing.
+   *  - we have committed our initial state (last_committed > 0)
    *
    * @param ver The version we want to check if is readable
    * @returns true if it is readable; false otherwise
@@ -555,7 +556,8 @@ public:
   bool is_readable(version_t ver = 0) {
     if (ver > get_last_committed() ||
        is_proposing() ||
-       !paxos->is_readable(0))
+       !paxos->is_readable(0) ||
+       get_last_committed() == 0)
       return false;
     return true;
   }
@@ -627,7 +629,8 @@ public:
      * happens to be readable at that specific point in time.
      */
     if (is_proposing() ||
-       ver > get_last_committed())
+       ver > get_last_committed() ||
+       get_last_committed() == 0)
       wait_for_finished_proposal(c);
     else
       paxos->wait_for_readable(c);