From: Matan Breizman Date: Tue, 31 Jan 2023 09:13:38 +0000 (+0000) Subject: osd: Rename max_oldest_map to cluster_osdmap_trim_lower_bound X-Git-Tag: v17.2.7~393^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2b0c93abe6ab7a820b46199bd6763d9ff80bc716;p=ceph.git osd: Rename max_oldest_map to cluster_osdmap_trim_lower_bound Signed-off-by: Matan Breizman (cherry picked from commit ff58b81ddff5e99a57ca6cf2c5dae560fbc8adad) --- diff --git a/doc/dev/osd_internals/past_intervals.rst b/doc/dev/osd_internals/past_intervals.rst index 467248593269..9d5342de0f96 100644 --- a/doc/dev/osd_internals/past_intervals.rst +++ b/doc/dev/osd_internals/past_intervals.rst @@ -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. diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 8610ba0cc5a3..d3acec59032a 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -347,7 +347,7 @@ public: // Not needed yet } - epoch_t max_oldest_stored_osdmap() final { + epoch_t cluster_osdmap_trim_lower_bound() final { // TODO return 0; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ceca805bfc08..cf4502ac3a31 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1336,7 +1336,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; @@ -1346,7 +1346,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; @@ -1419,7 +1420,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); @@ -3685,8 +3686,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; @@ -8076,11 +8077,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 diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 496c97d30785..fdcb815531ea 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1625,8 +1625,8 @@ void PG::on_new_interval() m_scrubber->on_maybe_registration_change(m_planned_scrub); } -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() { diff --git a/src/osd/PG.h b/src/osd/PG.h index b70e0126fbe7..05107bce99d3 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -590,7 +590,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; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 88b51397bb3b..89fafbe7e7d1 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -636,7 +636,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 @@ -930,9 +930,9 @@ static pair 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); diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 87fcca6fb820..c09653dd165d 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -404,7 +404,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; diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 8bdcf39be696..576215f421c1 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -5677,7 +5677,7 @@ void OSDSuperblock::encode(ceph::buffer::list &bl) const encode((uint32_t)0, bl); // map 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); } @@ -5718,9 +5718,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); } @@ -5741,7 +5741,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& o) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index f91189e77b3f..930128609102 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -5480,7 +5480,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); @@ -5497,7 +5497,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 + << ")"; }