From 9fba69a11aa940ed36339bb24b05cb92165db516 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 25 Mar 2014 15:32:30 -0700 Subject: [PATCH] OSD: allow build_incremental_map_msg to fail on lookups 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 --- src/osd/OSD.cc | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0c5a40a06f243..429ea79f99bb9 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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); } -- 2.39.5