]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Adding variables for Paxos trim
authorAishwarya Mathuria <amathuri@redhat.com>
Mon, 29 Mar 2021 14:05:12 +0000 (19:35 +0530)
committersinguliere <singuliere@autistici.org>
Fri, 9 Apr 2021 05:34:11 +0000 (07:34 +0200)
     1. Define variables for paxos_service_trim_min and paxos_service_trim_max.
     2. Use them in place of g_conf()→paxos_service_trim_min and g_conf()→paxos_service_trim_max

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
(cherry picked from commit 45c59f2f0d0d90beb9163804e86139c551cf505b)

src/mon/PaxosService.cc

index 8dff901c0676f1fd5150abecb1957e55291a51df..8366bc704b57706413effe23d6498187619a6ea8 100644 (file)
@@ -385,20 +385,22 @@ void PaxosService::maybe_trim()
   }
 
   version_t to_remove = trim_to - get_first_committed();
-  if (g_conf()->paxos_service_trim_min > 0 &&
-      to_remove < (version_t)g_conf()->paxos_service_trim_min) {
+  const version_t trim_min = g_conf().get_val<version_t>("paxos_service_trim_min");
+  if (trim_min > 0 &&
+      to_remove < trim_min) {
     dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove
-            << " < paxos_service_trim_min " << g_conf()->paxos_service_trim_min << dendl;
+            << " < paxos_service_trim_min " << trim_min << dendl;
     return;
   }
 
-  if (g_conf()->paxos_service_trim_max > 0 &&
-      to_remove > (version_t)g_conf()->paxos_service_trim_max) {
+  const version_t trim_max = g_conf().get_val<version_t>("paxos_service_trim_max");
+  if (trim_max > 0 &&
+      to_remove > trim_max) {
     dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove
-            << " > paxos_service_trim_max, limiting to " << g_conf()->paxos_service_trim_max
+            << " > paxos_service_trim_max, limiting to " << trim_max
             << dendl;
-    trim_to = get_first_committed() + g_conf()->paxos_service_trim_max;
-    to_remove = g_conf()->paxos_service_trim_max;
+    trim_to = get_first_committed() + trim_max;
+    to_remove = trim_max;
   }
 
   dout(10) << __func__ << " trimming to " << trim_to << ", " << to_remove << " states" << dendl;