diff options
author | Sage Weil <sage@inktank.com> | 2013-06-02 16:57:11 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-17 14:24:44 -0700 |
commit | 230578429183a0e812dd953a7ecb9d1aabb6cfd0 (patch) | |
tree | 8ecc3ebe10017c8367bc3af62e10c2ab6e7b358c | |
parent | 2ff8cf2051660cb4cec8d72ba03b9e24655af527 (diff) | |
download | ceph-230578429183a0e812dd953a7ecb9d1aabb6cfd0.tar.gz |
mon/Paxos: do paxos refresh in finish_proposal; and refactor
Do the paxos refresh inside finish_proposal, ordered *after* the leader
assertion so that MonmapMonitor::update_from_paxos() calling bootstrap()
does not kill us.
Also, remove unnecessary finish_queued_proposal() and move the logic inline
where the bad leader assertion is obvious.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/mon/Paxos.cc | 49 | ||||
-rw-r--r-- | src/mon/Paxos.h | 1 |
2 files changed, 18 insertions, 32 deletions
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 54579393c4d..9c6d11345e8 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -509,7 +509,6 @@ void Paxos::begin(bufferlist& v) // we're alone, take it easy commit(); state = STATE_ACTIVE; - mon->refresh_from_paxos(); finish_proposal(); finish_contexts(g_ceph_context, waiting_for_active); finish_contexts(g_ceph_context, waiting_for_commit); @@ -628,8 +627,6 @@ void Paxos::handle_accept(MMonPaxos *accept) state = STATE_ACTIVE; extend_lease(); - mon->refresh_from_paxos(); - finish_proposal(); // wake people up @@ -784,40 +781,30 @@ void Paxos::warn_on_future_time(utime_t t, entity_name_t from) } -void Paxos::finish_queued_proposal() +void Paxos::finish_proposal() { assert(mon->is_leader()); - assert(!proposals.empty()); - - dout(10) << __func__ << " finishing proposal" << dendl; - C_Proposal *proposal = static_cast<C_Proposal*>(proposals.front()); - dout(10) << __func__ << " finish it (proposal = " - << proposal << ")" << dendl;; - assert(proposal != NULL); + // make sure we have the latest state loaded up + mon->refresh_from_paxos(); - if (!proposal->proposed) { - dout(10) << __func__ << " we must have received a stay message and we're " - << "trying to finish before time. " - << "Instead, propose it (if we are active)!" << dendl; - } else { - dout(10) << __func__ << " proposal took " - << (ceph_clock_now(NULL) - proposal->proposal_time) - << " to finish" << dendl; + // finish off the last proposal + if (!proposals.empty()) { + assert(mon->is_leader()); - proposals.pop_front(); - proposal->complete(0); + C_Proposal *proposal = static_cast<C_Proposal*>(proposals.front()); + if (!proposal->proposed) { + dout(10) << __func__ << " proposal " << proposal << ": we must have received a stay message and we're " + << "trying to finish before time. " + << "Instead, propose it (if we are active)!" << dendl; + } else { + dout(10) << __func__ << " proposal " << proposal << " took " + << (ceph_clock_now(NULL) - proposal->proposal_time) + << " to finish" << dendl; + proposals.pop_front(); + proposal->complete(0); + } } -} - -void Paxos::finish_proposal() -{ - /* There is a lot of debug still going around. We will get rid of it later - * on, as soon as everything "just works (tm)" - */ - assert(mon->is_leader()); - if (!proposals.empty()) - finish_queued_proposal(); dout(10) << __func__ << " state " << state << " proposals left " << proposals.size() << dendl; diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 04553776b93..ff299106ece 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -994,7 +994,6 @@ private: * Begin proposing the Proposal at the front of the proposals queue. */ void propose_queued(); - void finish_queued_proposal(); void finish_proposal(); public: |