summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-23 10:21:51 -0700
committerSage Weil <sage@inktank.com>2013-05-23 10:21:51 -0700
commit6af640517f6fad797ccb15ae4f0b8439d557c423 (patch)
tree71f44a7658da4ce784e5bc9b9602dc9ba351e6c6
parente09e94424b52ea6695bab46c217b16850b47ec3c (diff)
parente15d29094503f279d444eda246fc45c09f5535c9 (diff)
downloadceph-6af640517f6fad797ccb15ae4f0b8439d557c423.tar.gz
Merge pull request #311 from ceph/wip-5102
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/mon/MonmapMonitor.cc2
-rw-r--r--src/mon/Paxos.cc28
-rw-r--r--src/mon/Paxos.h5
-rw-r--r--src/mon/PaxosService.h7
4 files changed, 12 insertions, 30 deletions
diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc
index badac7e0922..d7472797f15 100644
--- a/src/mon/MonmapMonitor.cc
+++ b/src/mon/MonmapMonitor.cc
@@ -111,7 +111,7 @@ void MonmapMonitor::update_from_paxos()
}
if (need_restart) {
- paxos->prepare_bootstrap();
+ mon->bootstrap();
}
}
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc
index 71ef2ec3de0..bfb9ed4f5dd 100644
--- a/src/mon/Paxos.cc
+++ b/src/mon/Paxos.cc
@@ -37,13 +37,6 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, const string& name,
<< ") ";
}
-void Paxos::prepare_bootstrap()
-{
- dout(0) << __func__ << dendl;
-
- going_to_bootstrap = true;
-}
-
MonitorDBStore *Paxos::get_store()
{
return mon->store;
@@ -445,6 +438,8 @@ void Paxos::handle_last(MMonPaxos *last)
dout(10) << "that's everyone. active!" << dendl;
extend_lease();
+ finish_proposal();
+
finish_contexts(g_ceph_context, waiting_for_active);
finish_contexts(g_ceph_context, waiting_for_readable);
finish_contexts(g_ceph_context, waiting_for_writeable);
@@ -834,12 +829,6 @@ void Paxos::finish_proposal()
first_committed = get_store()->get(get_name(), "first_committed");
last_committed = get_store()->get(get_name(), "last_committed");
- if (proposals.empty() && going_to_bootstrap) {
- dout(0) << __func__ << " no more proposals; bootstraping." << dendl;
- mon->bootstrap();
- return;
- }
-
if (should_trim()) {
trim();
}
@@ -1085,6 +1074,7 @@ void Paxos::shutdown() {
finish_contexts(g_ceph_context, waiting_for_commit, -ECANCELED);
finish_contexts(g_ceph_context, waiting_for_readable, -ECANCELED);
finish_contexts(g_ceph_context, waiting_for_active, -ECANCELED);
+ finish_contexts(g_ceph_context, proposals, -ECANCELED);
}
void Paxos::leader_init()
@@ -1092,9 +1082,7 @@ void Paxos::leader_init()
cancel_events();
new_value.clear();
if (!proposals.empty())
- proposals.clear();
-
- going_to_bootstrap = false;
+ finish_contexts(g_ceph_context, proposals, -EAGAIN);
if (mon->get_quorum().size() == 1) {
state = STATE_ACTIVE;
@@ -1119,6 +1107,7 @@ void Paxos::peon_init()
// no chance to write now!
finish_contexts(g_ceph_context, waiting_for_writeable, -EAGAIN);
finish_contexts(g_ceph_context, waiting_for_commit, -EAGAIN);
+ finish_contexts(g_ceph_context, proposals, -EAGAIN);
}
void Paxos::restart()
@@ -1126,12 +1115,11 @@ void Paxos::restart()
dout(10) << "restart -- canceling timeouts" << dendl;
cancel_events();
new_value.clear();
- dout(10) << __func__ << " -- clearing queued proposals" << dendl;
- if (!proposals.empty())
- proposals.clear();
state = STATE_RECOVERING;
- going_to_bootstrap = false;
+
+ if (!proposals.empty())
+ finish_contexts(g_ceph_context, proposals, -EAGAIN);
finish_contexts(g_ceph_context, waiting_for_commit, -EAGAIN);
finish_contexts(g_ceph_context, waiting_for_active, -EAGAIN);
diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h
index 2e1bb62dda9..160b02ecef2 100644
--- a/src/mon/Paxos.h
+++ b/src/mon/Paxos.h
@@ -530,7 +530,6 @@ private:
* @}
*/
- bool going_to_bootstrap;
/**
* Should be true if we have proposed to trim, or are in the middle of
* trimming; false otherwise.
@@ -1017,7 +1016,6 @@ public:
lease_timeout_event(0),
accept_timeout_event(0),
clock_drift_warned(0),
- going_to_bootstrap(false),
going_to_trim(false),
trim_disabled_version(0) { }
@@ -1025,9 +1023,6 @@ public:
return paxos_name;
}
- bool is_bootstrapping() { return going_to_bootstrap; }
- void prepare_bootstrap();
-
void dispatch(PaxosServiceMessage *m);
void reapply_all_versions();
diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h
index 0e4c9e23b02..4de73ea4b19 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -498,8 +498,7 @@ public:
*/
bool is_active() {
return (!is_proposing() && !paxos->is_recovering()
- && !paxos->is_locked()
- && !paxos->is_bootstrapping());
+ && !paxos->is_locked());
}
/**
@@ -579,7 +578,7 @@ public:
* @param c The callback to be awaken once we become active.
*/
void wait_for_active(Context *c) {
- if (paxos->is_bootstrapping() || !is_proposing()) {
+ if (!is_proposing()) {
paxos->wait_for_active(c);
return;
}
@@ -612,7 +611,7 @@ public:
* @param c The callback to be awaken once we become writeable.
*/
void wait_for_writeable(Context *c) {
- if (paxos->is_bootstrapping() || !is_proposing()) {
+ if (!is_proposing()) {
paxos->wait_for_writeable(c);
return;
}