]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: consolidate resetting in restart()
authorSage Weil <sage@inktank.com>
Mon, 15 Jul 2013 19:56:26 +0000 (12:56 -0700)
committerSage Weil <sage@inktank.com>
Mon, 15 Jul 2013 20:42:53 +0000 (13:42 -0700)
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 <sage@inktank.com>
src/mon/PaxosService.cc

index 43c7504d08bb3dbfe472182de3a5e3e7f67f86c8..f5416a8fa87d7582a25744eeddffcd6f0b3c5399 100644 (file)
@@ -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