From: Patrick Donnelly Date: Thu, 21 Jul 2022 19:46:58 +0000 (-0400) Subject: mds: add inject config for synthetic health message X-Git-Tag: v18.0.0~424^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3ecb987dde4f82450fb269110dea7f30ae2c2748;p=ceph.git mds: add inject config for synthetic health message This will be used to force the MDSMonitor to process a beacon in MDSMonitor::prepare_beacon. Signed-off-by: Patrick Donnelly --- diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index c0f821112d131..e56405e41808a 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -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 diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index 766e4c5d26711..78c92a3f1c655 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -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("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( diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index 82a310d1eee36..f2fa150bee31a 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -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 "???"; } diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 5b397cb59b6d9..b2fcd4052df52 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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 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;