From bd4d481307bfb1befbf4568a5a0a64300140ff6e Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Thu, 16 Nov 2023 10:19:51 +0000 Subject: [PATCH] osd/OSD: optimize send_incremental_map Previosuly, if `since` was earlier than the oldest_map, only the lastest full osdmap would be sent. However, we could actually send inc/full maps from oldest_map up to the current epoch. Moreover, build_incremental_map_msg is suited to handle this case as well. if `since` is earlier than `cluster_osdmap_trim_lower_bound` it will be adjusted accordingly. At any point, the cluster_osdmap_trim_lower_bound is later (or equal) to the superblock's oldest_map. See: past_intervals.rst (OSDSuperblock::maps) Hence, if since < oldest_map, and oldest_map <= clutser_lower_bound then since < cluster_lower_bound. Note: oldest_map stands as a mark to indicate up until which epoch the current OSD trimmed its osdmaps. See OSD::trim_maps(). Meaning, the OSDMaps in the range of [oldest_map, trim_lower_bound] may be at hand to be shared. Nevertheless, we should actually use the cluster_trim_lower_bound to set the correct range. Signed-off-by: Matan Breizman --- src/osd/OSD.cc | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d62695ae1c62e..136e51cccc81b 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1458,23 +1458,13 @@ void OSDService::send_incremental_map(epoch_t since, Connection *con, MOSDMap *m = NULL; OSDSuperblock sblock(get_superblock()); - if (since < sblock.get_oldest_map()) { - // just send latest full map - m = new MOSDMap(monc->get_fsid(), - osdmap->get_encoding_features()); - m->cluster_osdmap_trim_lower_bound = sblock.cluster_osdmap_trim_lower_bound; - m->newest_map = sblock.get_newest_map(); - get_map_bl(to, m->maps[to]); - } else { - 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; - } - - m = build_incremental_map_msg(since, to, sblock); + 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; } + m = build_incremental_map_msg(since, to, sblock); send_map(m, con); } -- 2.39.5