mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
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>
This commit is contained in:
parent
2fccb300bd
commit
a42d7582f8
@ -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()
|
||||
{
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
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();
|
||||
|
||||
// make sure we have the latest state loaded up
|
||||
mon->refresh_from_paxos();
|
||||
|
||||
// finish off the last proposal
|
||||
if (!proposals.empty()) {
|
||||
assert(mon->is_leader());
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
dout(10) << __func__ << " state " << state
|
||||
<< " proposals left " << proposals.size() << dendl;
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user