]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: allow build_incremental_map_msg to fail on lookups
authorGreg Farnum <greg@inktank.com>
Tue, 25 Mar 2014 22:32:30 +0000 (15:32 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 5 May 2014 22:29:19 +0000 (15:29 -0700)
Since we're now building incremental map messages out-of-band with doing
other map updates now, we need to tolerate lookup failures at the bottom
end. Do so by returning a NULL message in that case.
Handle that in send_incremental_map by looping until we get a
message back -- if we fail on the first attempt, we'll get
the OSDSuperblock again and deal with it.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/OSD.cc

index 0c5a40a06f243d20a71fc6742dc7b97dcf7ec36d..429ea79f99bb9e81ba1021bbc4a2ae088cb9d2e6 100644 (file)
@@ -6092,7 +6092,9 @@ MOSDMap *OSD::build_incremental_map_msg(epoch_t since, epoch_t to,
       derr << "since " << since << " to " << to
           << " oldest " << m->oldest_map << " newest " << m->newest_map
           << dendl;
-      assert(0 == "missing an osdmap on disk");  // we should have all maps.
+      m->put();
+      m = NULL;
+      break;
     }
   }
   return m;
@@ -6113,26 +6115,29 @@ void OSD::send_incremental_map(epoch_t since, Connection *con,
   dout(10) << "send_incremental_map " << since << " -> " << to
            << " to " << con << " " << con->get_peer_addr() << dendl;
 
-  OSDSuperblock superblock(service.get_superblock());
-  if (since < superblock.oldest_map) {
-    // just send latest full map
-    MOSDMap *m = new MOSDMap(monc->get_fsid());
-    m->oldest_map = superblock.oldest_map;
-    m->newest_map = superblock.newest_map;
-    get_map_bl(to, m->maps[to]);
-    send_map(m, con);
-    return;
-  }
-
-  if (to > since && (int64_t)(to - since) > cct->_conf->osd_map_share_max_epochs) {
-    dout(10) << "  " << (to - since) << " > max " << cct->_conf->osd_map_share_max_epochs
-            << ", only sending most recent" << dendl;
-    since = to - cct->_conf->osd_map_share_max_epochs;
+  MOSDMap *m = NULL;
+  while (!m) {
+    OSDSuperblock superblock(service.get_superblock());
+    if (since < superblock.oldest_map) {
+      // just send latest full map
+      MOSDMap *m = new MOSDMap(monc->get_fsid());
+      m->oldest_map = superblock.oldest_map;
+      m->newest_map = superblock.newest_map;
+      get_map_bl(to, m->maps[to]);
+      send_map(m, con);
+      return;
+    }
+    
+    if (to > since && (int64_t)(to - since) > cct->_conf->osd_map_share_max_epochs) {
+      dout(10) << "  " << (to - since) << " > max " << cct->_conf->osd_map_share_max_epochs
+              << ", only sending most recent" << dendl;
+      since = to - cct->_conf->osd_map_share_max_epochs;
+    }
+    
+    if (to - since > (epoch_t)cct->_conf->osd_map_message_max)
+      to = since + cct->_conf->osd_map_message_max;
+    m = build_incremental_map_msg(since, to, superblock);
   }
-
-  if (to - since > (epoch_t)cct->_conf->osd_map_message_max)
-    to = since + cct->_conf->osd_map_message_max;
-  MOSDMap *m = build_incremental_map_msg(since, to, superblock);
   send_map(m, con);
 }