]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: do not wait for readable in send_latest()
authorSage Weil <sage@inktank.com>
Fri, 19 Jul 2013 23:35:02 +0000 (16:35 -0700)
committerSage Weil <sage@inktank.com>
Fri, 19 Jul 2013 23:39:49 +0000 (16:39 -0700)
send_latest() checks for readable and, if untrue, will wait before sending
out the latest OSDMap.  This is completely unnecessary; I think it is a
hold-over from when we have independent paxos states.  An audit of all
callers confirms that everyone would be happy with whatever is committed,
even if we are in the process of committing an even newer version.

Effectively, everyone waits *above* this layer in the usual PaxosService
traps for whether we are readable or not.  This means that waiting_for_map
and send_to_waiting() go away entirely, which is nice.

This addresses, among other things: send_to_waiting() is called from
update_from_paxos(), which can be called when we are not readable due to
the paxos commit/finish timing changes in f1ce8d7c955a24 and
c711203c0d4b.  If no subsequent update happens, those waiters never get
their maps.

Instead, we send them immediately--we know they are committed and old
history is as good as future history.

Fixes: #5643
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index 95bd72c0b58ef5d951473593e11a9b52d2c0ed4a..82ff36d8469cd9c08e6329776f5f6c1f3d675c11 100644 (file)
@@ -185,7 +185,6 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
     mon->pgmon()->check_osd_map(osdmap.epoch);
   }
 
-  send_to_waiting();
   check_subs();
 
   share_map_with_random_osd();
@@ -312,16 +311,6 @@ void OSDMonitor::on_active()
 void OSDMonitor::on_shutdown()
 {
   dout(10) << __func__ << dendl;
-  map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
-  while (p != waiting_for_map.end()) {
-    while (!p->second.empty()) {
-      Message *m = p->second.front();
-      dout(20) << " discarding " << m << " " << *m << dendl;
-      m->put();
-      p->second.pop_front();
-    }
-    waiting_for_map.erase(p++);
-  }
 }
 
 void OSDMonitor::update_logger()
@@ -1444,53 +1433,15 @@ bool OSDMonitor::prepare_remove_snaps(MRemoveSnaps *m)
 // ---------------
 // map helpers
 
-void OSDMonitor::send_to_waiting()
-{
-  dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl;
-
-  map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
-  while (p != waiting_for_map.end()) {
-    epoch_t from = p->first;
-    
-    if (from) {
-      if (from <= osdmap.get_epoch()) {
-       while (!p->second.empty()) {
-         send_incremental(p->second.front(), from);
-         p->second.front()->put();
-         p->second.pop_front();
-       }
-      } else {
-       dout(10) << "send_to_waiting from " << from << dendl;
-       ++p;
-       continue;
-      }
-    } else {
-      while (!p->second.empty()) {
-       send_full(p->second.front());
-       p->second.front()->put();
-       p->second.pop_front();
-      }
-    }
-
-    waiting_for_map.erase(p++);
-  }
-}
-
 void OSDMonitor::send_latest(PaxosServiceMessage *m, epoch_t start)
 {
-  if (is_readable()) {
-    dout(5) << "send_latest to " << m->get_orig_source_inst()
-           << " start " << start << dendl;
-    if (start == 0)
-      send_full(m);
-    else
-      send_incremental(m, start);
-    m->put();
-  } else {
-    dout(5) << "send_latest to " << m->get_orig_source_inst()
-           << " start " << start << " later" << dendl;
-    waiting_for_map[start].push_back(m);
-  }
+  dout(5) << "send_latest to " << m->get_orig_source_inst()
+         << " start " << start << dendl;
+  if (start == 0)
+    send_full(m);
+  else
+    send_incremental(m, start);
+  m->put();
 }
 
 
index d65532283210ca62361d6fb44519b8c096b08af5..dda2374d7e88ef6bb11990f6f7822c501cf88729 100644 (file)
@@ -118,8 +118,6 @@ public:
   OSDMap osdmap;
 
 private:
-  map<epoch_t, list<PaxosServiceMessage*> > waiting_for_map;
-
   // [leader]
   OSDMap::Incremental pending_inc;
   map<int, failure_info_t> failure_info;
@@ -192,7 +190,6 @@ private:
   bool can_mark_in(int o);
 
   // ...
-  void send_to_waiting();     // send current map to waiters.
   MOSDMap *build_latest_full();
   MOSDMap *build_incremental(epoch_t first, epoch_t last);
   void send_full(PaxosServiceMessage *m);