]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add method to check for laggy osds
authordparmar18 <dparmar@redhat.com>
Thu, 16 Feb 2023 09:48:42 +0000 (15:18 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Fri, 30 Jun 2023 10:40:27 +0000 (16:10 +0530)
Fixes: https://tracker.ceph.com/issues/58023
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit 95fbe303a9692ac8dd2694298e32af951adfbe06)

src/osd/OSDMap.cc
src/osd/OSDMap.h

index 6e5caf53a1ae008cb12d076b5ae4eaec730cc339..2858934f023c1b4fe21a007e41af7212eb6bdc8a 100644 (file)
@@ -1838,6 +1838,18 @@ uint64_t OSDMap::get_up_osd_features() const
   return cached_up_osd_features;
 }
 
+bool OSDMap::any_osd_laggy() const
+{
+  for (int osd = 0; osd < max_osd; ++osd) {
+    if (!is_up(osd)) { continue; }
+    const auto &xi = get_xinfo(osd);
+    if (xi.laggy_probability || xi.laggy_interval) {
+      return true;
+    }
+  }
+  return false;
+}
+
 void OSDMap::dedup(const OSDMap *o, OSDMap *n)
 {
   using ceph::encode;
index 83ab75e0db427ddeb651ae9ba47fe3a2478300c9..fee74bfcbe95d7d541a34583bc3aa4f7bdf97a4c 100644 (file)
@@ -643,6 +643,7 @@ private:
  public:
   bool have_crc() const { return crc_defined; }
   uint32_t get_crc() const { return crc; }
+  bool any_osd_laggy() const;
 
   std::shared_ptr<CrushWrapper> crush;       // hierarchical map
   bool stretch_mode_enabled; // we are in stretch mode, requiring multiple sites