]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: fix ReplicaReservations ctor to use correct query
authorRonen Friedman <rfriedma@redhat.com>
Sun, 28 Jul 2024 10:52:38 +0000 (05:52 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sun, 25 Aug 2024 13:01:00 +0000 (08:01 -0500)
when determining whether replica reservations are required.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/pg_scrubber.h
src/osd/scrubber/scrub_machine_lstnr.h
src/osd/scrubber/scrub_reservations.cc

index 37b461cf3bbf50213254513d3ef0d584648672d7..4b439bf8ec5cf289109fe3be0b45ae11f486d103 100644 (file)
@@ -946,9 +946,10 @@ int PgScrubber::get_whoami() const
   return m_osds->whoami;
 }
 
-[[nodiscard]] bool PgScrubber::is_high_priority() const
+[[nodiscard]] bool PgScrubber::is_reservation_required() const
 {
-  return m_flags.required;
+  ceph_assert(m_active_target);
+  return ScrubJob::requires_reservation(m_active_target->urgency());
 }
 
 /*
index a2f607a8401b020876279496b955592b213b20cb..0b114e5458846f7b0cd17769cdfd3860c174c7b8 100644 (file)
@@ -398,8 +398,8 @@ class PgScrubber : public ScrubPgIF,
     return m_pg->recovery_state.is_primary();
   }
 
-  /// is this scrub more than just regular periodic scrub?
-  [[nodiscard]] bool is_high_priority() const final;
+  /// is this scrub's urgency high enough, or must it reserve its replicas?
+  [[nodiscard]] bool is_reservation_required() const final;
 
   void set_state_name(const char* name) final
   {
index 39b853bb6f9742f6f50bd0df78e0980e8e012ea4..050e29cb8e2c24e4d93a7db1f1481adafc594f02 100644 (file)
@@ -250,6 +250,6 @@ struct ScrubMachineListener {
   /// delay next retry of this PG after a replica reservation failure
   virtual void flag_reservations_failure() = 0;
 
-  /// is this scrub more than just regular periodic scrub?
-  [[nodiscard]] virtual bool is_high_priority() const = 0;
+  /// is this scrub's urgency high enough, or must it reserve its replicas?
+  [[nodiscard]] virtual bool is_reservation_required() const = 0;
 };
index ec9ac598ea517f2d88dc13a10b492ba1df491faf..fb9593597e97a8534f6968554b528dfadf083036 100644 (file)
@@ -54,15 +54,15 @@ ReplicaReservations::ReplicaReservations(
   m_perf_set.set(scrbcnt_resrv_replicas_num, m_sorted_secondaries.size());
 
   m_next_to_request = m_sorted_secondaries.cbegin();
-  if (m_scrubber.is_high_priority()) {
+  if (m_scrubber.is_reservation_required()) {
+    // send out the 1'st request (unless we have no replicas)
+    m_process_started_at = ScrubClock::now();
+    send_next_reservation_or_complete();
+  } else {
     // for high-priority scrubs (i.e. - user-initiated), no reservations are
     // needed. Note: not perf-counted as either success or failure.
     dout(10) << "high-priority scrub - no reservations needed" << dendl;
     m_perf_set.inc(scrbcnt_resrv_skipped);
-  } else {
-    // send out the 1'st request (unless we have no replicas)
-    m_process_started_at = ScrubClock::now();
-    send_next_reservation_or_complete();
   }
 }