]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add inject config for synthetic health message
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 21 Jul 2022 19:46:58 +0000 (15:46 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 25 Jul 2022 13:57:15 +0000 (09:57 -0400)
This will be used to force the MDSMonitor to process a beacon in
MDSMonitor::prepare_beacon.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/common/options/mds.yaml.in
src/mds/Beacon.cc
src/messages/MMDSBeacon.h
src/mon/MDSMonitor.cc

index c0f821112d131fb1b88ef658dac412d8cb5b6ae5..e56405e41808adc3b0ef22621ef5061d0069fba0 100644 (file)
@@ -1054,6 +1054,12 @@ options:
   services:
   - mds
   with_legacy: true
+- name: mds_inject_health_dummy
+  type: bool
+  level: dev
+  default: false
+  services:
+  - mds
 #  percentage of MDS modify replies to skip sending the client a trace on [0-1]
 - name: mds_inject_traceless_reply_probability
   type: float
index 766e4c5d26711e7a55b00eafebea1dc223e91bd0..78c92a3f1c655c28c583193bbc10538301c9f666 100644 (file)
@@ -14,6 +14,7 @@
 
 
 #include "common/dout.h"
+#include "common/likely.h"
 #include "common/HeartbeatMap.h"
 
 #include "include/stringify.h"
@@ -298,6 +299,11 @@ void Beacon::notify_health(MDSRank const *mds)
 
   health.metrics.clear();
 
+  if (unlikely(g_conf().get_val<bool>("mds_inject_health_dummy"))) {
+    MDSHealthMetric m(MDS_HEALTH_DUMMY, HEALTH_ERR, std::string("dummy"));
+    health.metrics.push_back(m);
+  }
+
   // Detect presence of entries in DamageTable
   if (!mds->damage_table.empty()) {
     MDSHealthMetric m(MDS_HEALTH_DAMAGE, HEALTH_ERR, std::string(
index 82a310d1eee36270ee7626441379c20fa4be1fa9..f2fa150bee31accddaa4713e462ca8b899a98c4c 100644 (file)
@@ -45,6 +45,7 @@ enum mds_metric_t {
   MDS_HEALTH_SLOW_REQUEST,
   MDS_HEALTH_CACHE_OVERSIZED,
   MDS_HEALTH_SLOW_METADATA_IO,
+  MDS_HEALTH_DUMMY, // not a real health warning, for testing
 };
 
 inline const char *mds_metric_name(mds_metric_t m)
@@ -62,6 +63,7 @@ inline const char *mds_metric_name(mds_metric_t m)
   case MDS_HEALTH_SLOW_REQUEST: return "MDS_SLOW_REQUEST";
   case MDS_HEALTH_CACHE_OVERSIZED: return "MDS_CACHE_OVERSIZED";
   case MDS_HEALTH_SLOW_METADATA_IO: return "MDS_SLOW_METADATA_IO";
+  case MDS_HEALTH_DUMMY: return "MDS_DUMMY";
   default:
     return "???";
   }
index 5b397cb59b6d96ccc063157572ec1b6cd77b48b7..b2fcd4052df52fdedafd42560a7fe97b10d5915d 100644 (file)
@@ -248,6 +248,9 @@ void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t)
       health.decode(bl_i);
     }
     for (const auto &metric : health.metrics) {
+      if (metric.type == MDS_HEALTH_DUMMY) {
+        continue;
+      }
       const auto rank = info.rank;
       health_check_t *check = &new_checks.get_or_add(
        mds_metric_name(metric.type),
@@ -593,10 +596,16 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
 
   std::set<mds_metric_t> new_types;
   for (const auto &i : new_health) {
+    if (i.type == MDS_HEALTH_DUMMY) {
+      continue;
+    }
     new_types.insert(i.type);
   }
 
   for (const auto &new_metric: new_health) {
+    if (new_metric.type == MDS_HEALTH_DUMMY) {
+      continue;
+    }
     if (old_types.count(new_metric.type) == 0) {
       dout(10) << "MDS health message (" << m->get_orig_source()
               << "): " << new_metric.sev << " " << new_metric.message << dendl;