From: Sage Weil Date: Mon, 15 Jul 2013 19:56:26 +0000 (-0700) Subject: mon/PaxosService: consolidate resetting in restart() X-Git-Tag: v0.67-rc1~78^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1fc85acdb82919863ed6aa3cd38c99b522e692a1;p=ceph.git mon/PaxosService: consolidate resetting in restart() We had duplicated code in election_finished() and restart(), and it was incomplete. Put it all in restart() only (the mon should have called restart() long before the election finishes). Note that we cannot assert as much in election_finished() because another service may have just cross-proposed. Signed-off-by: Sage Weil --- diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 43c7504d08bb..f5416a8fa87d 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -231,6 +231,12 @@ void PaxosService::restart() finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); + if (have_pending) { + discard_pending(); + have_pending = false; + } + proposing = false; + on_restart(); } @@ -238,18 +244,6 @@ void PaxosService::election_finished() { dout(10) << "election_finished" << dendl; - if (proposal_timer) { - dout(10) << " canceling proposal_timer " << proposal_timer << dendl; - mon->timer.cancel_event(proposal_timer); - proposal_timer = 0; - } - - if (have_pending) { - discard_pending(); - have_pending = false; - } - proposing = false; - finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); // make sure we update our state