From 1fc85acdb82919863ed6aa3cd38c99b522e692a1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Jul 2013 12:56:26 -0700 Subject: [PATCH] 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 --- src/mon/PaxosService.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 43c7504d08bb3..f5416a8fa87d7 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 -- 2.39.5