]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: trim_maps - remove nrecieved
authorMatan Breizman <mbreizma@redhat.com>
Thu, 6 Jul 2023 10:22:03 +0000 (10:22 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 19 Jul 2023 12:31:15 +0000 (12:31 +0000)
The intention of `nrecieved` was to guarantee that we will trim [first, last) of
the current MOSDMap being handled. However, this is not true anymore since we trim based on cluster_osdmap_trim_lower_bound.

For instance, we might begin trimming when we receieve a MOSDMap with first epoch of 799 and last of 800 and cluster_osdmap_trim_lower_bound of 200.
If our superblock's oldest_map is 1 (no trimming occurred yet), we are allowed to trim up to 200.
There is no relation between the current MOSDMap handled amount of epochs receieved
(last - first + 1) to the epoch where we allowed to trim to.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index e5e68c8aa880d5429aab972dd1c9cc2fe3bc8a6a..705ad0ca0fa25d91270b6d25aae618d6959a2e36 100644 (file)
@@ -7945,7 +7945,7 @@ void OSD::osdmap_subscribe(version_t epoch, bool force_request)
   }
 }
 
-void OSD::trim_maps(epoch_t oldest, int nreceived, bool skip_maps)
+void OSD::trim_maps(epoch_t oldest, bool skip_maps)
 {
   epoch_t min = std::min(oldest, service.map_cache.cached_key_lower_bound());
   if (min <= superblock.oldest_map)
@@ -7959,10 +7959,7 @@ void OSD::trim_maps(epoch_t oldest, int nreceived, bool skip_maps)
     t.remove(coll_t::meta(), get_inc_osdmap_pobject_name(e));
     superblock.oldest_map = e + 1;
     num++;
-    // make sure we at least keep pace with incoming maps
-    // even if we exceed osd_target_transaction_size.
-    if (num >= cct->_conf->osd_target_transaction_size &&
-        num >= nreceived) {
+    if (num >= cct->_conf->osd_target_transaction_size) {
       service.publish_superblock(superblock);
       write_superblock(cct, superblock, t);
       int tr = store->queue_transaction(service.meta_ch, std::move(t), nullptr);
@@ -8227,8 +8224,7 @@ void OSD::handle_osd_map(MOSDMap *m)
   }
 
   if (superblock.oldest_map) {
-    trim_maps(m->cluster_osdmap_trim_lower_bound,
-              last - first + 1, skip_maps);
+    trim_maps(m->cluster_osdmap_trim_lower_bound, skip_maps);
     pg_num_history.prune(superblock.oldest_map);
   }
 
index 7003c1b7b864e57878dfa43677c6a5b4b2338bea..3993e7a2fbdea407f8d99b1a3eb8a7f5657355e1 100644 (file)
@@ -1685,7 +1685,7 @@ protected:
 
   void handle_osd_map(class MOSDMap *m);
   void _committed_osd_maps(epoch_t first, epoch_t last, class MOSDMap *m);
-  void trim_maps(epoch_t oldest, int nreceived, bool skip_maps);
+  void trim_maps(epoch_t oldest, bool skip_maps);
   void note_down_osd(int osd);
   void note_up_osd(int osd);
   friend struct C_OnMapCommit;