Skip to content

Commit e66ddcf

Browse files
authored
Merge pull request ceph#64837 from rzarzynski/wip-bug-72412
osd: stop scrub_purged_snaps() from ignoring osd_beacon_report_interval
2 parents 6d07935 + d4f90ea commit e66ddcf

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
@@ -6454,20 +6454,7 @@ void OSD::tick_without_osd_lock()
64546454
service.get_scrub_services().initiate_scrub(service.is_recovery_active());
64556455
service.promote_throttle_recalibrate();
64566456
resume_creating_pg();
6457-
bool need_send_beacon = false;
6458-
const auto now = ceph::coarse_mono_clock::now();
6459-
{
6460-
// borrow lec lock to pretect last_sent_beacon from changing
6461-
std::lock_guard l{min_last_epoch_clean_lock};
6462-
const auto elapsed = now - last_sent_beacon;
6463-
if (std::chrono::duration_cast<std::chrono::seconds>(elapsed).count() >
6464-
cct->_conf->osd_beacon_report_interval) {
6465-
need_send_beacon = true;
6466-
}
6467-
}
6468-
if (need_send_beacon) {
6469-
send_beacon(now);
6470-
}
6457+
maybe_send_beacon();
64716458
}
64726459

64736460
mgrc.update_daemon_health(get_health_metrics());
@@ -7383,6 +7370,26 @@ void OSD::send_beacon(const ceph::coarse_mono_clock::time_point& now)
73837370
}
73847371
}
73857372

7373+
void OSD::maybe_send_beacon()
7374+
{
7375+
bool need_send_beacon = false;
7376+
const auto now = ceph::coarse_mono_clock::now();
7377+
{
7378+
// borrow lec lock to protect last_sent_beacon from changing
7379+
std::lock_guard l{min_last_epoch_clean_lock};
7380+
const auto elapsed = now - last_sent_beacon;
7381+
if (std::chrono::duration_cast<std::chrono::seconds>(elapsed).count() >
7382+
cct->_conf->osd_beacon_report_interval) {
7383+
need_send_beacon = true;
7384+
}
7385+
}
7386+
if (need_send_beacon) {
7387+
send_beacon(now);
7388+
} else {
7389+
dout(20) << __func__ << " beacon would be too frequent; skipping" << dendl;
7390+
}
7391+
}
7392+
73867393
void OSD::handle_command(MCommand *m)
73877394
{
73887395
ConnectionRef con = m->get_connection();
@@ -7469,7 +7476,7 @@ void OSD::scrub_purged_snaps()
74697476
int tr = store->queue_transaction(service.meta_ch, std::move(t), nullptr);
74707477
ceph_assert(tr == 0);
74717478
if (is_active()) {
7472-
send_beacon(ceph::coarse_mono_clock::now());
7479+
maybe_send_beacon();
74737480
}
74747481
dout(10) << __func__ << " done" << dendl;
74757482
}

src/osd/OSD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,6 +2045,7 @@ class OSD : public Dispatcher,
20452045
// which pgs were scanned for min_lec
20462046
std::vector<pg_t> min_last_epoch_clean_pgs;
20472047
void send_beacon(const ceph::coarse_mono_clock::time_point& now);
2048+
void maybe_send_beacon();
20482049

20492050
ceph_tid_t get_tid() {
20502051
return service.get_tid();

0 commit comments

Comments
 (0)