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: v16.2.14~69^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=05e7a0693281b441bd7472b6860d552138cb1b37;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 61159ca1ad02..ed5abd356639 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -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; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 36c8fa8c0b23..7e4e06cea72c 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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 diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1850bd8a6d14..eb3b8b8f12d3 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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() { diff --git a/src/osd/PG.h b/src/osd/PG.h index ba5f1d71fed4..baf5b5a57b54 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 2401abda0ab2..ecd7952229ad 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -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 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 9467b43e90bc..c28543a173a1 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -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; diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 018ddf3fe2af..901e180465bf 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -5582,7 +5582,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); } @@ -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& o) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 1eb152e50060..afbd0f0d0fae 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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 + << ")"; }