]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: allow others to sync from us across bootstrap calls
authorSage Weil <sage@inktank.com>
Tue, 30 Jul 2013 00:14:57 +0000 (17:14 -0700)
committerSage Weil <sage@inktank.com>
Tue, 30 Jul 2013 00:14:57 +0000 (17:14 -0700)
If someone is syncing from us and there is an election, they currently get
reset and have to restart their sync.  This can lead to situations where
they can never finish, e.g., when the load from them syncing makes us time
out commits and call elections.

There is nothing that changes during bootstrap that would prevent a sync
from proceeding.  The only time we need to stop providing is when we
ourselves decide to sync from someone else; modify that reset call to
reset provider state.  All other resets become requester resets.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 3b19b51405447cbd7f2c0d7aaf12b764149712ae..2c21e6eac69aa58f73574104797c6413b067a30e 100644 (file)
@@ -619,7 +619,7 @@ void Monitor::bootstrap()
 {
   dout(10) << "bootstrap" << dendl;
 
-  sync_reset();
+  sync_reset_requester();
   unregister_cluster_logger();
   cancel_probe_timeout();
 
@@ -806,23 +806,27 @@ void Monitor::sync_obtain_latest_monmap(bufferlist &bl)
   latest_monmap.encode(bl, CEPH_FEATURES_ALL);
 }
 
-void Monitor::sync_reset()
+void Monitor::sync_reset_requester()
 {
+  dout(10) << __func__ << dendl;
+
   if (sync_timeout_event) {
     timer.cancel_event(sync_timeout_event);
     sync_timeout_event = NULL;
   }
 
-  // leader state
-  sync_providers.clear();
-
-  // requester state
   sync_provider = entity_inst_t();
   sync_cookie = 0;
   sync_full = false;
   sync_start_version = 0;
 }
 
+void Monitor::sync_reset_provider()
+{
+  dout(10) << __func__ << dendl;
+  sync_providers.clear();
+}
+
 void Monitor::sync_start(entity_inst_t &other, bool full)
 {
   dout(10) << __func__ << " " << other << (full ? " full" : " recent") << dendl;
@@ -832,7 +836,7 @@ void Monitor::sync_start(entity_inst_t &other, bool full)
   state = STATE_SYNCHRONIZING;
 
   // make sure are not a provider for anyone!
-  sync_reset();
+  sync_reset_provider();
 
   sync_full = full;
 
index bed48ecee3436093858f8af979e2805972088bcc..35975e7a90f9b7e1c1626558701952b04bb38c12 100644 (file)
@@ -301,10 +301,14 @@ private:
   set<string> get_sync_targets_names();
 
   /**
-   * Reset the monitor's sync-related data structures and state, both
-   * for the requester- and provider-side.
+   * Reset the monitor's sync-related data structures for syncing *from* a peer
    */
-  void sync_reset();
+  void sync_reset_requester();
+
+  /**
+   * Reset sync state related to allowing others to sync from us
+   */
+  void sync_reset_provider();
 
   /**
    * Caled when a sync attempt times out (requester-side)