summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-02 16:57:11 -0700
committerSage Weil <sage@inktank.com>2013-06-24 16:16:40 -0700
commit6ac58cd9c1f9c80c5f3cbe97e19cfcd8427db46d (patch)
treec0d447a5a1edca372572f364181830de64bd285f
parent054e96d96533b1c4078402e43184f13b97329905 (diff)
downloadceph-6ac58cd9c1f9c80c5f3cbe97e19cfcd8427db46d.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> (cherry picked from commit a42d7582f816b45f5d19c393fd45447555e78fdd)
-rw-r--r--src/mon/Paxos.cc49
-rw-r--r--src/mon/Paxos.h1
2 files changed, 18 insertions, 32 deletions
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc
index 6adf191ee91..0b90722de80 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: