]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/perf-counters: replace 'assert' with 'ceph_assert' 61469/head
authorRonen Friedman <rfriedma@redhat.com>
Tue, 21 Jan 2025 14:11:48 +0000 (08:11 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 4 Feb 2025 14:30:38 +0000 (16:30 +0200)
Mostly - as some tests depend on it. But generally - preferring to
be able to detect the problems in production code.

https://tracker.ceph.com/issues/69613

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/common/perf_counters_cache.cc

index fb63b7acfed43e545a8da793e288660b8eece373..851160b783f7672e48fcc7dab23f72e0e5488cfa 100644 (file)
@@ -6,15 +6,15 @@ namespace ceph::perf_counters {
 void PerfCountersCache::check_key(const std::string &key) {
   [[maybe_unused]] std::string_view key_name = ceph::perf_counters::key_name(key);
   // don't accept an empty key name
-  assert(key_name != "");
+  ceph_assert(key_name != "");
 
   // if there are no labels, key name is not valid
   auto key_labels = ceph::perf_counters::key_labels(key);
-  assert(key_labels.begin() != key_labels.end());
+  ceph_assert(key_labels.begin() != key_labels.end());
 
   // don't accept keys where any labels in the key have an empty key name
   for ([[maybe_unused]] auto key_label : key_labels) {
-    assert(key_label.first != "");
+    ceph_assert(key_label.first != "");
   }
 }
 
@@ -24,7 +24,7 @@ std::shared_ptr<PerfCounters> PerfCountersCache::add(const std::string &key) {
   auto [ref, key_existed] = cache.get_or_create(key);
   if (!key_existed) {
     ref->counters = create_counters(key, cct);
-    assert(ref->counters);
+    ceph_assert(ref->counters);
     ref->cct = cct;
   }
   return ref->counters;