From: Radoslaw Zarzynski Date: Tue, 5 Aug 2025 14:11:59 +0000 (+0200) Subject: osd: stop scrub_purged_snaps() from ignoring osd_beacon_report_interval X-Git-Tag: testing/wip-jcollin-testing-20251004.055540-tentacle~23^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=814b2766f4e696d38aab9b194ef445e1388e0529;p=ceph-ci.git osd: stop scrub_purged_snaps() from ignoring osd_beacon_report_interval OSD beacons could be burdersome to the enitre cluster, as they lead to generation of new `OSDMap` epochs. Therefore their frequency is restricted through `osd_beacon_report_interval` to 5 mins by default. Unfortunately, the `OSD::send_purged_snaps()` is unaware about this policy with the net result being storm of OSDMaps. This patch unifies its behavior with `OSD::tick_without_osd_lock()`. Fixes: https://tracker.ceph.com/issues/72412 Signed-off-by: Radoslaw Zarzynski (cherry picked from commit d4f90ea6d3c5c565d1ddc6f9ecd9499048f054c0) --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a1175bfc9d7..b354e1d4306 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6512,20 +6512,7 @@ void OSD::tick_without_osd_lock() service.get_scrub_services().initiate_scrub(service.is_recovery_active()); service.promote_throttle_recalibrate(); resume_creating_pg(); - bool need_send_beacon = false; - const auto now = ceph::coarse_mono_clock::now(); - { - // borrow lec lock to pretect last_sent_beacon from changing - std::lock_guard l{min_last_epoch_clean_lock}; - const auto elapsed = now - last_sent_beacon; - if (std::chrono::duration_cast(elapsed).count() > - cct->_conf->osd_beacon_report_interval) { - need_send_beacon = true; - } - } - if (need_send_beacon) { - send_beacon(now); - } + maybe_send_beacon(); } mgrc.update_daemon_health(get_health_metrics()); @@ -7423,6 +7410,26 @@ void OSD::send_beacon(const ceph::coarse_mono_clock::time_point& now) } } +void OSD::maybe_send_beacon() +{ + bool need_send_beacon = false; + const auto now = ceph::coarse_mono_clock::now(); + { + // borrow lec lock to protect last_sent_beacon from changing + std::lock_guard l{min_last_epoch_clean_lock}; + const auto elapsed = now - last_sent_beacon; + if (std::chrono::duration_cast(elapsed).count() > + cct->_conf->osd_beacon_report_interval) { + need_send_beacon = true; + } + } + if (need_send_beacon) { + send_beacon(now); + } else { + dout(20) << __func__ << " beacon would be too frequent; skipping" << dendl; + } +} + void OSD::handle_command(MCommand *m) { ConnectionRef con = m->get_connection(); @@ -7509,7 +7516,7 @@ void OSD::scrub_purged_snaps() int tr = store->queue_transaction(service.meta_ch, std::move(t), nullptr); ceph_assert(tr == 0); if (is_active()) { - send_beacon(ceph::coarse_mono_clock::now()); + maybe_send_beacon(); } dout(10) << __func__ << " done" << dendl; } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 84f70c86a40..cd2a492240b 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1882,6 +1882,7 @@ protected: // which pgs were scanned for min_lec std::vector min_last_epoch_clean_pgs; void send_beacon(const ceph::coarse_mono_clock::time_point& now); + void maybe_send_beacon(); ceph_tid_t get_tid() { return service.get_tid();