]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: sort configs
authorPatrick Donnelly <pdonnell@ibm.com>
Thu, 14 Nov 2024 17:29:49 +0000 (12:29 -0500)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 17 Mar 2025 19:43:16 +0000 (15:43 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
Fixes: https://tracker.ceph.com/issues/66373
(cherry picked from commit a84c396e7d34fc5af676f4dc4fdb0d81b2e84a3c)

src/client/Client.cc

index 81e8ef2591d53191168005f89a03536d1e093aa9..b0d93d39a32bc5bb91d3d64d94e492478f744920 100644 (file)
@@ -17330,21 +17330,33 @@ void Client::set_cap_epoch_barrier(epoch_t e)
 
 const char** Client::get_tracked_conf_keys() const
 {
-  static const char* keys[] = {
-    "client_cache_size",
-    "client_cache_mid",
-    "client_acl_type",
-    "client_deleg_timeout",
-    "client_deleg_break_on_open",
-    "client_oc_size",
-    "client_oc_max_objects",
-    "client_oc_max_dirty",
-    "client_oc_target_dirty",
-    "client_oc_max_dirty_age",
-    "client_caps_release_delay",
-    "client_mount_timeout",
-    NULL
-  };
+#define KEYS \
+    "client_acl_type", \
+    "client_cache_mid", \
+    "client_cache_size", \
+    "client_caps_release_delay", \
+    "client_deleg_break_on_open", \
+    "client_deleg_timeout", \
+    "client_mount_timeout", \
+    "client_oc_max_dirty", \
+    "client_oc_max_dirty_age", \
+    "client_oc_max_objects", \
+    "client_oc_size", \
+    "client_oc_target_dirty" \
+
+  constexpr bool is_sorted = [] () constexpr {
+    constexpr auto arr = std::to_array<std::string_view>({KEYS});
+    for (unsigned long i = 0; i < arr.size()-1; ++i) {
+      if (arr[i] > arr[i+1]) {
+        return false;
+      }
+    }
+    return true;
+  }();
+  static_assert(is_sorted, "keys are not sorted!");
+
+  static char const* keys[] = {KEYS, nullptr};
+
   return keys;
 }