]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: fix proposal waiter handling
authorSage Weil <sage@inktank.com>
Tue, 19 Mar 2013 04:00:06 +0000 (21:00 -0700)
committerSage Weil <sage@inktank.com>
Tue, 19 Mar 2013 04:00:06 +0000 (21:00 -0700)
- Cancel the propsal waiters with EAGAIN on election, etc.
- Drop the wakeup helper and open-code the one caller.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PaxosService.cc
src/mon/PaxosService.h

index dc179d0ff62c6238aa6bc26351f1c58aba038247..a66c5ec06122179654d02ae04248c624a8ed44e2 100644 (file)
@@ -189,8 +189,8 @@ void PaxosService::restart()
     mon->timer.cancel_event(proposal_timer);
     proposal_timer = 0;
   }
-  // ignore any callbacks waiting for us to finish our proposal
-  waiting_for_finished_proposal.clear();
+
+  finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
 
   on_restart();
 }
@@ -210,8 +210,7 @@ void PaxosService::election_finished()
   }
   proposing.set(0);
 
-  // ignore any callbacks waiting for us to finish our proposal
-  waiting_for_finished_proposal.clear();
+  finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
 
   // make sure we update our state
   if (is_active())
@@ -256,10 +255,11 @@ void PaxosService::_active()
     }
   }
 
-  /* wake people up before calling on_active(). We don't know how long we'll be
-   * on the service's on_active(), and we really should wake people up!
-   */
-  wakeup_proposing_waiters();
+  // wake up anyone who came in while we were proposing.  note that
+  // anyone waiting for the previous proposal to commit is no longer
+  // on this list; it is on Paxos's.
+  finish_contexts(g_ceph_context, waiting_for_finished_proposal, 0);
+
   // NOTE: it's possible that this will get called twice if we commit
   // an old paxos value.  Implementations should be mindful of that.
   if (is_active())
@@ -275,8 +275,8 @@ void PaxosService::shutdown()
     mon->timer.cancel_event(proposal_timer);
     proposal_timer = 0;
   }
-  // ignore any callbacks waiting for us to finish our proposal
-  waiting_for_finished_proposal.clear();
+
+  finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
 }
 
 void PaxosService::put_version(MonitorDBStore::Transaction *t,
@@ -298,11 +298,6 @@ int PaxosService::get_version(const string& prefix, version_t ver,
   return mon->store->get(get_service_name(), key, bl);
 }
 
-void PaxosService::wakeup_proposing_waiters()
-{
-  finish_contexts(g_ceph_context, waiting_for_finished_proposal);
-}
-
 void PaxosService::trim(MonitorDBStore::Transaction *t,
                        version_t from, version_t to)
 {
index cfe764160edaa4079f84c335fbd073e954f9f9b5..30a7b6dfe51e581771f31e8814f4f0af4670e3f5 100644 (file)
@@ -560,11 +560,6 @@ public:
     wait_for_finished_proposal(c);
   }
 
-  /**
-   * Wakeup all the callbacks waiting for the proposal to be finished
-   */
-  void wakeup_proposing_waiters();
-
   /**
    * @defgroup PaxosService_h_Trim
    * @{