From 3cbdbd0e8d8fef5f7374e228b9f3ec5a1610949d Mon Sep 17 00:00:00 2001 From: Dan van der Ster Date: Thu, 19 Jun 2025 17:58:29 -0700 Subject: [PATCH] mon: add LARGE_CRUSH_BUCKET heath warning Signed-off-by: Dan van der Ster --- src/common/options/mon.yaml.in | 11 ++++++++++- src/mon/PGMap.cc | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/common/options/mon.yaml.in b/src/common/options/mon.yaml.in index 2c337fcea7072..49765cdfd174a 100644 --- a/src/common/options/mon.yaml.in +++ b/src/common/options/mon.yaml.in @@ -1412,4 +1412,13 @@ options: - mon flags: - runtime - \ No newline at end of file +- name: mon_warn_on_large_crush_bucket + type: bool + level: advanced + desc: Raise a LARGE_CRUSH_BUCKET health check warning if any CRUSH bucket + nears the maximum weight of 65535. + default: true + services: + - mon + flags: + - runtime diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 07304cfcd8e64..cb2d12a4f8141 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -3490,6 +3490,21 @@ void PGMap::get_health_checks( d.detail.swap(detail); } } + + // LARGE_CRUSH_BUCKET + if (g_conf().get_val("mon_warn_on_large_crush_bucket")) { + for (int b = 0; b < osdmap.crush->get_max_buckets(); ++b) { + int bid = -1 - b; + if (osdmap.crush->bucket_exists(bid) && + osdmap.crush->get_bucket_weightf(bid) > 60000.0) { + ostringstream ss; + ss << "CRUSH bucket " << osdmap.crush->get_item_name(bid) + << " is nearing the maximum weight of 65535"; + auto& d = checks->add("LARGE_CRUSH_BUCKET", HEALTH_WARN, ss.str(), 1); + d.detail.push_back("use a smaller osd_crush_scaling_factor before adding more OSDs"); + } + } + } } void PGMap::print_summary(ceph::Formatter *f, ostream *out) const -- 2.39.5