diff options
author | Sage Weil <sage@inktank.com> | 2013-07-08 10:49:28 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-13 14:31:50 -0700 |
commit | 658240710baaf9c661b8fbf856322907a0d394ee (patch) | |
tree | b4dbed7a914b630f7a79bebda237b6be9e100280 | |
parent | 5c3ff33771e227b3fb5cc354323846fe8db4ecc1 (diff) | |
download | ceph-658240710baaf9c661b8fbf856322907a0d394ee.tar.gz |
mon/PaxosService: prevent reads until initial service commit is done
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>
(cherry picked from commit d08b6d6df7dba06dad73bdec2c945f24afc02717)
-rw-r--r-- | src/mon/PaxosService.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 1b994dcbe84..9d2812f86b9 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -536,6 +536,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 @@ -543,7 +544,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; } @@ -615,7 +617,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); |