dout(10) << "that's everyone. active!" << dendl;
extend_lease();
- finish_proposal();
+ if (do_refresh()) {
+ 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);
+ finish_contexts(g_ceph_context, waiting_for_active);
+ finish_contexts(g_ceph_context, waiting_for_readable);
+ finish_contexts(g_ceph_context, waiting_for_writeable);
+ }
}
}
} else {
if (mon->get_quorum().size() == 1) {
// we're alone, take it easy
commit();
- finish_proposal();
- finish_contexts(g_ceph_context, waiting_for_active);
- finish_contexts(g_ceph_context, waiting_for_commit);
- finish_contexts(g_ceph_context, waiting_for_readable);
- finish_contexts(g_ceph_context, waiting_for_writeable);
+ if (do_refresh()) {
+ finish_proposal();
+ finish_contexts(g_ceph_context, waiting_for_active);
+ finish_contexts(g_ceph_context, waiting_for_commit);
+ finish_contexts(g_ceph_context, waiting_for_readable);
+ finish_contexts(g_ceph_context, waiting_for_writeable);
+ }
return;
}
// note: this may happen before the lease is reextended (below)
dout(10) << " got majority, committing" << dendl;
commit();
+ if (!do_refresh())
+ goto out;
}
// done?
finish_contexts(g_ceph_context, waiting_for_readable);
finish_contexts(g_ceph_context, waiting_for_writeable);
}
+
+ out:
accept->put();
}
}
-void Paxos::finish_proposal()
+bool Paxos::do_refresh()
{
- assert(mon->is_leader());
+ bool need_bootstrap = false;
// make sure we have the latest state loaded up
- bool need_bootstrap = false;
mon->refresh_from_paxos(&need_bootstrap);
+ if (need_bootstrap) {
+ dout(10) << " doing requested bootstrap" << dendl;
+ mon->bootstrap();
+ return false;
+ }
+
+ return true;
+}
+
+void Paxos::finish_proposal()
+{
+ assert(mon->is_leader());
+
// ok, now go active!
state = STATE_ACTIVE;
dout(10) << __func__ << " state " << state
<< " proposals left " << proposals.size() << dendl;
- if (need_bootstrap) {
- dout(10) << " doing requested bootstrap" << dendl;
- mon->bootstrap();
- return;
- }
-
if (should_trim()) {
trim();
}