diff options
author | Sage Weil <sage@inktank.com> | 2013-03-18 21:00:06 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-03-18 21:00:06 -0700 |
commit | 7aec13f749035b9bef5e398c1ac3d56ceec8eb81 (patch) | |
tree | 445d702446d432e73f2fb8056bedd3402fe96738 | |
parent | 35ab2a4189103abc25035a489a74b8261e9317c2 (diff) | |
download | ceph-7aec13f749035b9bef5e398c1ac3d56ceec8eb81.tar.gz |
mon/PaxosService: fix proposal waiter handling
- Cancel the propsal waiters with EAGAIN on election, etc.
- Drop the wakeup helper and open-code the one caller.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rw-r--r-- | src/mon/PaxosService.cc | 25 | ||||
-rw-r--r-- | src/mon/PaxosService.h | 5 |
2 files changed, 10 insertions, 20 deletions
diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index dc179d0ff62..a66c5ec0612 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -189,8 +189,8 @@ void PaxosService::restart() mon->timer.cancel_event(proposal_timer); proposal_timer = 0; } - // ignore any callbacks waiting for us to finish our proposal - waiting_for_finished_proposal.clear(); + + finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); on_restart(); } @@ -210,8 +210,7 @@ void PaxosService::election_finished() } proposing.set(0); - // ignore any callbacks waiting for us to finish our proposal - waiting_for_finished_proposal.clear(); + finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); // make sure we update our state if (is_active()) @@ -256,10 +255,11 @@ void PaxosService::_active() } } - /* wake people up before calling on_active(). We don't know how long we'll be - * on the service's on_active(), and we really should wake people up! - */ - wakeup_proposing_waiters(); + // wake up anyone who came in while we were proposing. note that + // anyone waiting for the previous proposal to commit is no longer + // on this list; it is on Paxos's. + finish_contexts(g_ceph_context, waiting_for_finished_proposal, 0); + // NOTE: it's possible that this will get called twice if we commit // an old paxos value. Implementations should be mindful of that. if (is_active()) @@ -275,8 +275,8 @@ void PaxosService::shutdown() mon->timer.cancel_event(proposal_timer); proposal_timer = 0; } - // ignore any callbacks waiting for us to finish our proposal - waiting_for_finished_proposal.clear(); + + finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); } void PaxosService::put_version(MonitorDBStore::Transaction *t, @@ -298,11 +298,6 @@ int PaxosService::get_version(const string& prefix, version_t ver, return mon->store->get(get_service_name(), key, bl); } -void PaxosService::wakeup_proposing_waiters() -{ - finish_contexts(g_ceph_context, waiting_for_finished_proposal); -} - void PaxosService::trim(MonitorDBStore::Transaction *t, version_t from, version_t to) { diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index cfe764160ed..30a7b6dfe51 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -561,11 +561,6 @@ public: } /** - * Wakeup all the callbacks waiting for the proposal to be finished - */ - void wakeup_proposing_waiters(); - - /** * @defgroup PaxosService_h_Trim * @{ */ |