]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: send full map if we don't have sufficiently old incremental
authorSage Weil <sage@newdream.net>
Fri, 14 Oct 2011 20:28:51 +0000 (13:28 -0700)
committerSage Weil <sage@newdream.net>
Fri, 14 Oct 2011 20:30:52 +0000 (13:30 -0700)
If the peer has a really old map, send a full map instead of crashing
because we are missing the needed incremental.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/OSD.cc
src/osd/OSD.h

index 623f415521788ceae2c418214771bf82409dac20..5f9bf882739630dde1743fdab084691b07481bdb 100644 (file)
@@ -3548,23 +3548,37 @@ MOSDMap *OSD::build_incremental_map_msg(epoch_t since, epoch_t to)
   return m;
 }
 
+void OSD::send_map(MOSDMap *m, const entity_inst_t& inst, bool lazy)
+{
+  Messenger *msgr = client_messenger;
+  if (entity_name_t::TYPE_OSD == inst.name._type)
+    msgr = cluster_messenger;
+  if (lazy)
+    msgr->lazy_send_message(m, inst);  // only if we already have an open connection
+  else
+    msgr->send_message(m, inst);
+}
+
 void OSD::send_incremental_map(epoch_t since, const entity_inst_t& inst, bool lazy)
 {
   dout(10) << "send_incremental_map " << since << " -> " << osdmap->get_epoch()
            << " to " << inst << dendl;
   
+  if (since < superblock.oldest_map) {
+    // just send latest full map
+    MOSDMap *m = new MOSDMap(monc->get_fsid());
+    epoch_t e = osdmap->get_epoch();
+    get_map_bl(e, m->maps[e]);
+    send_map(m, inst, lazy);
+    return;
+  }
+
   while (since < osdmap->get_epoch()) {
     epoch_t to = osdmap->get_epoch();
     if (to - since > (epoch_t)g_conf->osd_map_message_max)
       to = since + g_conf->osd_map_message_max;
     MOSDMap *m = build_incremental_map_msg(since, to);
-    Messenger *msgr = client_messenger;
-    if (entity_name_t::TYPE_OSD == inst.name._type)
-      msgr = cluster_messenger;
-    if (lazy)
-      msgr->lazy_send_message(m, inst);  // only if we already have an open connection
-    else
-      msgr->send_message(m, inst);
+    send_map(m, inst, lazy);
     since = to;
   }
 }
index 2b9d1a7d93ac7e3e6356bbebffb6a3bda67940d1..c1b0ab50861e7c49d40de22c4d414a36393115f8 100644 (file)
@@ -419,6 +419,8 @@ private:
   
   MOSDMap *build_incremental_map_msg(epoch_t from, epoch_t to);
   void send_incremental_map(epoch_t since, const entity_inst_t& inst, bool lazy=false);
+  void send_map(MOSDMap *m, const entity_inst_t& inst, bool lazy);
+
 
 protected:
   Watch *watch; /* notify-watch handler */