]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: optimize send_incremental_map
authorMatan Breizman <mbreizma@redhat.com>
Thu, 16 Nov 2023 10:19:51 +0000 (10:19 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 18 Dec 2023 13:19:08 +0000 (13:19 +0000)
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 <mbreizma@redhat.com>
src/osd/OSD.cc

index d62695ae1c62e60f483168e9e093c92cf23de279..136e51cccc81b8acb39d75085ca56020dc4e2b84 100644 (file)
@@ -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);
 }