]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrub: skip reserving replicas for high-priority scrubs
authorRonen Friedman <rfriedma@redhat.com>
Tue, 14 Nov 2023 12:01:08 +0000 (06:01 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 30 Nov 2023 11:40:27 +0000 (05:40 -0600)
(The primary side of the required changes)

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 a88a09aeb07bb9043157e066d72e32c6d69fcaf9..edc6c2a2dcd4cf5340c3b32a67c4cc35152ef636 100644 (file)
@@ -800,7 +800,7 @@ void PgScrubber::cancel_callback(scrubber_callback_cancel_token_t token)
   m_osds->sleep_timer.cancel_event(token);
 }
 
-LogChannelRef &PgScrubber::get_clog() const
+LogChannelRefPgScrubber::get_clog() const
 {
   return m_osds->clog;
 }
@@ -810,6 +810,11 @@ int PgScrubber::get_whoami() const
   return m_osds->whoami;
 }
 
+[[nodiscard]] bool PgScrubber::is_high_priority() const
+{
+  return m_flags.required;
+}
+
 /*
  * The selected range is set directly into 'm_start' and 'm_end'
  * setting:
index 2553e49b263ab5e82b6b4b5a165a306740e4e93f..832fa17050cc767e095ab67b206f8c264087d8e5 100644 (file)
@@ -402,6 +402,9 @@ 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;
+
   void set_state_name(const char* name) final
   {
     m_fsm_state_name = name;
index 890a70a8a129af9d43d4759897831fb093dd3697..34247083f4fd8faa2c30b3dfa78a9c3e748200c1 100644 (file)
@@ -229,4 +229,7 @@ struct ScrubMachineListener {
   // temporary interface (to be discarded in a follow-up PR)
   /// set the 'resources_failure' flag in the scrub-job object
   virtual void flag_reservations_failure() = 0;
+
+  /// is this scrub more than just regular periodic scrub?
+  [[nodiscard]] virtual bool is_high_priority() const = 0;
 };
index 3194c9871d57d3a352d2f40c33f7417e4d0e0457..449856e7b45989ff8471570473f46f0ab9ad96d6 100644 (file)
@@ -49,12 +49,17 @@ ReplicaReservations::ReplicaReservations(ScrubMachineListener& scrbr)
       });
 
   m_next_to_request = m_sorted_secondaries.cbegin();
-  // send out the 1'st request (unless we have no replicas)
-  send_next_reservation_or_complete();
-
-  m_slow_response_warn_timeout =
-      m_scrubber.get_pg_cct()->_conf.get_val<milliseconds>(
-         "osd_scrub_slow_reservation_response");
+  if (m_scrubber.is_high_priority()) {
+    // for high-priority scrubs (i.e. - user-initiated), no reservations are
+    // needed.
+    dout(10) << "high-priority scrub - no reservations needed" << dendl;
+  } else {
+    // send out the 1'st request (unless we have no replicas)
+    send_next_reservation_or_complete();
+    m_slow_response_warn_timeout =
+       m_scrubber.get_pg_cct()->_conf.get_val<milliseconds>(
+           "osd_scrub_slow_reservation_response");
+  }
 }
 
 void ReplicaReservations::release_all()