]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: modify slow-replica-reply warning implementation
authorRonen Friedman <rfriedma@redhat.com>
Sat, 14 Oct 2023 12:55:42 +0000 (07:55 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 14 Oct 2023 18:49:01 +0000 (21:49 +0300)
Merging the 'do once' functionality into the timeout duration.

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

index 4d187a2a644f1b0b2e7bccdaf7903a6e704d97f2..3194c9871d57d3a352d2f40c33f7417e4d0e0457 100644 (file)
@@ -51,6 +51,10 @@ 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");
 }
 
 void ReplicaReservations::release_all()
@@ -100,15 +104,14 @@ bool ReplicaReservations::handle_reserve_grant(OpRequestRef op, pg_shard_t from)
   auto elapsed = clock::now() - m_last_request_sent_at;
 
   // log a warning if the response was slow to arrive
-  auto warn_timeout = m_scrubber.get_pg_cct()->_conf.get_val<milliseconds>(
-      "osd_scrub_slow_reservation_response");
-  if (!m_slow_response_warned && (elapsed > warn_timeout)) {
+  if ((m_slow_response_warn_timeout > 0ms) &&
+      (elapsed > m_slow_response_warn_timeout)) {
     dout(1) << fmt::format(
                   "slow reservation response from {} ({}ms)", from,
                   duration_cast<milliseconds>(elapsed).count())
            << dendl;
     // prevent additional warnings
-    m_slow_response_warned = true;
+    m_slow_response_warn_timeout = 0ms;
   }
   dout(10) << fmt::format(
                  "granted by {} ({} of {}) in {}ms", from,
index a603c70735631e8729688980066a16c7fb98297d..1f2628579dcc6b7d05668f673512f1f95fec1ff1 100644 (file)
@@ -66,8 +66,9 @@ class ReplicaReservations {
   /// for logs, and for detecting slow peers
   clock::time_point m_last_request_sent_at;
 
-  /// used to prevent multiple "slow response" warnings
-  bool m_slow_response_warned{false};
+  /// the 'slow response' timeout (in milliseconds) - as configured.
+  /// Doubles as a 'do once' flag for the warning.
+  std::chrono::milliseconds m_slow_response_warn_timeout;
 
  public:
   ReplicaReservations(ScrubMachineListener& scrubber);