diff options
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/scrubber/osd_scrub.cc | 4 | ||||
-rw-r--r-- | src/osd/scrubber/pg_scrubber.cc | 2 | ||||
-rw-r--r-- | src/osd/scrubber/scrub_machine.cc | 8 | ||||
-rw-r--r-- | src/osd/scrubber/scrub_reservations.cc | 3 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/osd/scrubber/osd_scrub.cc b/src/osd/scrubber/osd_scrub.cc index d2d2db3ff72..48f978b18e3 100644 --- a/src/osd/scrubber/osd_scrub.cc +++ b/src/osd/scrubber/osd_scrub.cc @@ -266,10 +266,10 @@ OsdScrub::LoadTracker::LoadTracker( ///\todo replace with Knuth's algo (to reduce the numerical error) std::optional<double> OsdScrub::LoadTracker::update_load_average() { - int hb_interval = conf->osd_heartbeat_interval; + auto hb_interval = conf->osd_heartbeat_interval; int n_samples = std::chrono::duration_cast<seconds>(24h).count(); if (hb_interval > 1) { - n_samples = std::max(n_samples / hb_interval, 1); + n_samples = std::max(n_samples / hb_interval, 1L); } double loadavg; diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 9fe7295201d..e1604222c2c 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1504,7 +1504,7 @@ void PgScrubber::apply_snap_mapper_fixes( void PgScrubber::maps_compare_n_cleanup() { - m_pg->add_objects_scrubbed_count(m_be->get_primary_scrubmap().objects.size()); + m_pg->add_objects_scrubbed_count(std::ssize(m_be->get_primary_scrubmap().objects)); auto required_fixes = m_be->scrub_compare_maps(m_end.is_max(), get_snap_mapper_accessor()); diff --git a/src/osd/scrubber/scrub_machine.cc b/src/osd/scrubber/scrub_machine.cc index 66ba0751d0e..acdddbd18eb 100644 --- a/src/osd/scrubber/scrub_machine.cc +++ b/src/osd/scrubber/scrub_machine.cc @@ -214,6 +214,7 @@ sc::result Session::react(const IntervalChanged&) DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases dout(10) << "Session::react(const IntervalChanged&)" << dendl; + ceph_assert(m_reservations); m_reservations->discard_remote_reservations(); return transit<NotActive>(); } @@ -267,7 +268,9 @@ sc::result ReservingReplicas::react(const ReplicaGrant& ev) dout(10) << "ReservingReplicas::react(const ReplicaGrant&)" << dendl; const auto& m = ev.m_op->get_req<MOSDScrubReserve>(); - if (context<Session>().m_reservations->handle_reserve_grant(*m, ev.m_from)) { + auto& session = context<Session>(); + ceph_assert(session.m_reservations); + if (session.m_reservations->handle_reserve_grant(*m, ev.m_from)) { // we are done with the reservation process return transit<ActiveScrubbing>(); } @@ -279,6 +282,7 @@ sc::result ReservingReplicas::react(const ReplicaReject& ev) DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases auto& session = context<Session>(); dout(10) << "ReservingReplicas::react(const ReplicaReject&)" << dendl; + ceph_assert(session.m_reservations); const auto m = ev.m_op->get_req<MOSDScrubReserve>(); // Verify that the message is from the replica we were expecting a reply from, @@ -306,6 +310,8 @@ sc::result ReservingReplicas::react(const ReservationTimeout&) DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases auto& session = context<Session>(); dout(10) << "ReservingReplicas::react(const ReservationTimeout&)" << dendl; + ceph_assert(session.m_reservations); + session.m_reservations->log_failure_and_duration(scrbcnt_resrv_timed_out); const auto msg = fmt::format( diff --git a/src/osd/scrubber/scrub_reservations.cc b/src/osd/scrubber/scrub_reservations.cc index b9cc2d096ad..ec9ac598ea5 100644 --- a/src/osd/scrubber/scrub_reservations.cc +++ b/src/osd/scrubber/scrub_reservations.cc @@ -94,11 +94,12 @@ void ReplicaReservations::discard_remote_reservations() void ReplicaReservations::log_success_and_duration() { + ceph_assert(m_process_started_at.has_value()); auto logged_duration = ScrubClock::now() - m_process_started_at.value(); m_perf_set.tinc(scrbcnt_resrv_successful_elapsed, logged_duration); m_perf_set.inc(scrbcnt_resrv_success); m_osds->logger->hinc( - l_osd_scrub_reservation_dur_hist, m_sorted_secondaries.size(), + l_osd_scrub_reservation_dur_hist, std::ssize(m_sorted_secondaries), logged_duration.count()); m_process_started_at.reset(); } |