Skip to content

Commit d4f90ea

Browse files
committed
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 <[email protected]>
1 parent be41017 commit d4f90ea

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

src/osd/OSD.cc

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6538,20 +6538,7 @@ void OSD::tick_without_osd_lock()
65386538
service.get_scrub_services().initiate_scrub(service.is_recovery_active());
65396539
service.promote_throttle_recalibrate();
65406540
resume_creating_pg();
6541-
bool need_send_beacon = false;
6542-
const auto now = ceph::coarse_mono_clock::now();
6543-
{
6544-
// borrow lec lock to pretect last_sent_beacon from changing
6545-
std::lock_guard l{min_last_epoch_clean_lock};
6546-
const auto elapsed = now - last_sent_beacon;
6547-
if (std::chrono::duration_cast<std::chrono::seconds>(elapsed).count() >
6548-
cct->_conf->osd_beacon_report_interval) {
6549-
need_send_beacon = true;
6550-
}
6551-
}
6552-
if (need_send_beacon) {
6553-
send_beacon(now);
6554-
}
6541+
maybe_send_beacon();
65556542
}
65566543

65576544
mgrc.update_daemon_health(get_health_metrics());
@@ -7466,6 +7453,26 @@ void OSD::send_beacon(const ceph::coarse_mono_clock::time_point& now)
74667453
}
74677454
}
74687455

7456+
void OSD::maybe_send_beacon()
7457+
{
7458+
bool need_send_beacon = false;
7459+
const auto now = ceph::coarse_mono_clock::now();
7460+
{
7461+
// borrow lec lock to protect last_sent_beacon from changing
7462+
std::lock_guard l{min_last_epoch_clean_lock};
7463+
const auto elapsed = now - last_sent_beacon;
7464+
if (std::chrono::duration_cast<std::chrono::seconds>(elapsed).count() >
7465+
cct->_conf->osd_beacon_report_interval) {
7466+
need_send_beacon = true;
7467+
}
7468+
}
7469+
if (need_send_beacon) {
7470+
send_beacon(now);
7471+
} else {
7472+
dout(20) << __func__ << " beacon would be too frequent; skipping" << dendl;
7473+
}
7474+
}
7475+
74697476
void OSD::handle_command(MCommand *m)
74707477
{
74717478
ConnectionRef con = m->get_connection();
@@ -7552,7 +7559,7 @@ void OSD::scrub_purged_snaps()
75527559
int tr = store->queue_transaction(service.meta_ch, std::move(t), nullptr);
75537560
ceph_assert(tr == 0);
75547561
if (is_active()) {
7555-
send_beacon(ceph::coarse_mono_clock::now());
7562+
maybe_send_beacon();
75567563
}
75577564
dout(10) << __func__ << " done" << dendl;
75587565
}

src/osd/OSD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,7 @@ class OSD : public Dispatcher,
18821882
// which pgs were scanned for min_lec
18831883
std::vector<pg_t> min_last_epoch_clean_pgs;
18841884
void send_beacon(const ceph::coarse_mono_clock::time_point& now);
1885+
void maybe_send_beacon();
18851886

18861887
ceph_tid_t get_tid() {
18871888
return service.get_tid();

0 commit comments

Comments
 (0)