]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Rename max_oldest_map to cluster_osdmap_trim_lower_bound
authorMatan Breizman <mbreizma@redhat.com>
Tue, 31 Jan 2023 09:13:38 +0000 (09:13 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Tue, 16 May 2023 09:57:59 +0000 (09:57 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit ff58b81ddff5e99a57ca6cf2c5dae560fbc8adad)

doc/dev/osd_internals/past_intervals.rst
src/crimson/osd/pg.h
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/osd_types.cc
src/osd/osd_types.h

index 46724859326934606f247a3f5847a1386f52a34f..9d5342de0f963ba1aa6290b13c4a572319395f46 100644 (file)
@@ -81,12 +81,13 @@ trimmed up to epoch ``e``, we know that the PG must have been clean at some epoc
 
 This dependency also pops up in PeeringState::check_past_interval_bounds().
 PeeringState::get_required_past_interval_bounds takes as a parameter
-oldest_epoch, which comes from OSDSuperblock::max_oldest_map. We use
-max_oldest_map rather than a specific osd's oldest_map because we don't
-necessarily trim all MOSDMap::oldest_map. In order to avoid doing too much
-work at once we limit the amount of osdmaps trimmed using
+oldest_epoch, which comes from OSDSuperblock::cluster_osdmap_trim_lower_bound.
+We use cluster_osdmap_trim_lower_bound rather than a specific osd's oldest_map
+because we don't necessarily trim all MOSDMap::oldest_map. In order to avoid
+doing too much work at once we limit the amount of osdmaps trimmed using
 ``osd_target_transaction_size`` in OSD::trim_maps().
-For this reason, a specific OSD's oldest_map can lag OSDSuperblock::max_oldest_map
+For this reason, a specific OSD's oldest_map can lag behind
+OSDSuperblock::cluster_osdmap_trim_lower_bound
 for a while.
 
 See https://tracker.ceph.com/issues/49689 for an example.
index 61159ca1ad027b1c62ef529623a41ffc3b22b08f..ed5abd356639468e8e511d562ab6834effb179cc 100644 (file)
@@ -345,7 +345,7 @@ public:
     // Not needed yet
   }
 
-  epoch_t max_oldest_stored_osdmap() final {
+  epoch_t cluster_osdmap_trim_lower_bound() final {
     // TODO
     return 0;
   }
index 36c8fa8c0b23b78aabd149855d83d43fb5d9b153..7e4e06cea72c5b5dd064ca956525e16469c651e7 100644 (file)
@@ -1415,7 +1415,7 @@ MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
 {
   MOSDMap *m = new MOSDMap(monc->get_fsid(),
                           osdmap->get_encoding_features());
-  m->oldest_map = sblock.max_oldest_map;
+  m->oldest_map = sblock.cluster_osdmap_trim_lower_bound;
   m->newest_map = sblock.newest_map;
 
   int max = cct->_conf->osd_map_message_max;
@@ -1425,7 +1425,8 @@ MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
     // we don't have the next map the target wants, so start with a
     // full map.
     bufferlist bl;
-    dout(10) << __func__ << " oldest map " << sblock.max_oldest_map
+    dout(10) << __func__ << " cluster osdmap lower bound "
+             << sblock.cluster_osdmap_trim_lower_bound
              << " > since " << since << ", starting with full map"
              << dendl;
     since = m->oldest_map;
@@ -1498,7 +1499,7 @@ void OSDService::send_incremental_map(epoch_t since, Connection *con,
       // just send latest full map
       MOSDMap *m = new MOSDMap(monc->get_fsid(),
                               osdmap->get_encoding_features());
-      m->oldest_map = sblock.max_oldest_map;
+      m->oldest_map = sblock.cluster_osdmap_trim_lower_bound;
       m->newest_map = sblock.newest_map;
       get_map_bl(to, m->maps[to]);
       send_map(m, con);
@@ -3633,8 +3634,8 @@ int OSD::init()
     // do anything else
     dout(5) << "Upgrading superblock adding: " << diff << dendl;
 
-    if (!superblock.max_oldest_map) {
-      superblock.max_oldest_map = superblock.oldest_map;
+    if (!superblock.cluster_osdmap_trim_lower_bound) {
+      superblock.cluster_osdmap_trim_lower_bound = superblock.oldest_map;
     }
 
     ObjectStore::Transaction t;
@@ -8136,11 +8137,12 @@ void OSD::handle_osd_map(MOSDMap *m)
   if (first <= superblock.newest_map)
     logger->inc(l_osd_mape_dup, superblock.newest_map - first + 1);
 
-  if (superblock.max_oldest_map < m->oldest_map) {
-    superblock.max_oldest_map = m->oldest_map;
-    dout(10) << " superblock max_oldest_map new epoch is: "
-             << superblock.max_oldest_map << dendl;
-    ceph_assert(superblock.max_oldest_map >= superblock.oldest_map);
+  if (superblock.cluster_osdmap_trim_lower_bound < m->oldest_map) {
+    superblock.cluster_osdmap_trim_lower_bound = m->oldest_map;
+    dout(10) << " superblock cluster_osdmap_trim_lower_bound new epoch is: "
+             << superblock.cluster_osdmap_trim_lower_bound << dendl;
+    ceph_assert(
+      superblock.cluster_osdmap_trim_lower_bound >= superblock.oldest_map);
   }
 
   // make sure there is something new, here, before we bother flushing
index 1850bd8a6d145ead053a0b7f4d9837c4edff5c4d..eb3b8b8f12d3d5569186ab91fa4418f3f4c8476e 100644 (file)
@@ -1572,8 +1572,8 @@ void PG::on_new_interval()
   cancel_recovery();
 }
 
-epoch_t PG::max_oldest_stored_osdmap() {
-  return osd->get_superblock().max_oldest_map;
+epoch_t PG::cluster_osdmap_trim_lower_bound() {
+  return osd->get_superblock().cluster_osdmap_trim_lower_bound;
 }
 
 OstreamTemp PG::get_clog_info() {
index ba5f1d71fed42872cfecac30ff57a6e3a9ab62ab..baf5b5a57b54745a375d019b5823acf27dbc1a63 100644 (file)
@@ -518,7 +518,7 @@ public:
   void clear_publish_stats() override;
   void clear_primary_state() override;
 
-  epoch_t max_oldest_stored_osdmap() override;
+  epoch_t cluster_osdmap_trim_lower_bound() override;
   OstreamTemp get_clog_error() override;
   OstreamTemp get_clog_info() override;
   OstreamTemp get_clog_debug() override;
index 2401abda0ab24166f11868abae4e00afa501a680..ecd7952229ade1c05ef0ac1117b29da1594d7c1b 100644 (file)
@@ -665,7 +665,7 @@ void PeeringState::start_peering_interval(
     psdout(10) << __func__ << ": check_new_interval output: "
               << debug.str() << dendl;
     if (new_interval) {
-      if (osdmap->get_epoch() == pl->max_oldest_stored_osdmap() &&
+      if (osdmap->get_epoch() == pl->cluster_osdmap_trim_lower_bound() &&
          info.history.last_epoch_clean < osdmap->get_epoch()) {
        psdout(10) << " map gap, clearing past_intervals and faking" << dendl;
        // our information is incomplete and useless; someone else was clean
@@ -953,9 +953,9 @@ static pair<epoch_t, epoch_t> get_required_past_interval_bounds(
 
 void PeeringState::check_past_interval_bounds() const
 {
-  // a specific OSD's oldest_map can lag for a while, therfore
-  // use the maximum MOSDMap.oldest_map received with peers.
-  auto oldest_epoch = pl->max_oldest_stored_osdmap();
+  // cluster_osdmap_trim_lower_bound gives us a bound on needed
+  // intervals, see doc/dev/osd_internals/past_intervals.rst
+  auto oldest_epoch = pl->cluster_osdmap_trim_lower_bound();
   auto rpib = get_required_past_interval_bounds(
     info,
     oldest_epoch);
index 9467b43e90bc997105020592e12c43a34df505ce..c28543a173a1e1b74027535bb2b2c4590c4bd8bd 100644 (file)
@@ -390,7 +390,7 @@ public:
     // ==================== Std::map notifications ===================
     virtual void on_active_actmap() = 0;
     virtual void on_active_advmap(const OSDMapRef &osdmap) = 0;
-    virtual epoch_t max_oldest_stored_osdmap() = 0;
+    virtual epoch_t cluster_osdmap_trim_lower_bound() = 0;
 
     // ============ recovery reservation notifications ==========
     virtual void on_backfill_reserved() = 0;
index 018ddf3fe2af121a1cc34bd32609a3714dbb3e0f..901e180465bf42fc7a69b3a7b821ef6bbe9fb386 100644 (file)
@@ -5582,7 +5582,7 @@ void OSDSuperblock::encode(ceph::buffer::list &bl) const
   encode((uint32_t)0, bl);  // map<int64_t,epoch_t> pool_last_epoch_marked_full
   encode(purged_snaps_last, bl);
   encode(last_purged_snaps_scrub, bl);
-  encode(max_oldest_map, bl);
+  encode(cluster_osdmap_trim_lower_bound, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -5623,9 +5623,9 @@ void OSDSuperblock::decode(ceph::buffer::list::const_iterator &bl)
     purged_snaps_last = 0;
   }
   if (struct_v >= 10) {
-    decode(max_oldest_map, bl);
+    decode(cluster_osdmap_trim_lower_bound, bl);
   } else {
-    max_oldest_map = 0;
+    cluster_osdmap_trim_lower_bound = 0;
   }
   DECODE_FINISH(bl);
 }
@@ -5646,7 +5646,8 @@ void OSDSuperblock::dump(Formatter *f) const
   f->dump_int("last_epoch_mounted", mounted);
   f->dump_unsigned("purged_snaps_last", purged_snaps_last);
   f->dump_stream("last_purged_snaps_scrub") << last_purged_snaps_scrub;
-  f->dump_int("max_oldest_map", max_oldest_map);
+  f->dump_int("cluster_osdmap_trim_lower_bound",
+              cluster_osdmap_trim_lower_bound);
 }
 
 void OSDSuperblock::generate_test_instances(list<OSDSuperblock*>& o)
index 1eb152e500602f9cd7545e13d4756daed4e27e4e..afbd0f0d0fae6cc7d9c6bd127201b4ed22ce61d5 100644 (file)
@@ -5407,7 +5407,7 @@ public:
   epoch_t purged_snaps_last = 0;
   utime_t last_purged_snaps_scrub;
 
-  epoch_t max_oldest_map = 0;  // maximum oldest map we have.
+  epoch_t cluster_osdmap_trim_lower_bound = 0;
 
   void encode(ceph::buffer::list &bl) const;
   void decode(ceph::buffer::list::const_iterator &bl);
@@ -5424,7 +5424,8 @@ inline std::ostream& operator<<(std::ostream& out, const OSDSuperblock& sb)
              << " e" << sb.current_epoch
              << " [" << sb.oldest_map << "," << sb.newest_map << "]"
             << " lci=[" << sb.mounted << "," << sb.clean_thru << "]"
-             << " max oldest=" << sb.max_oldest_map << ")";
+             << " tlb=" << sb.cluster_osdmap_trim_lower_bound
+             << ")";
 }