]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: simplify paxos_service_trim_min check
authorSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 04:58:13 +0000 (21:58 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 18:09:46 +0000 (11:09 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/PaxosService.cc

index 2f3bacc36dbf55ececdab1256ae20f9eeecf6951..72a1c5e531de7219a97c3c14582eb78edb3cbf93 100644 (file)
@@ -327,15 +327,15 @@ void PaxosService::maybe_trim()
     return;
 
   version_t trim_to = get_trim_to();
-  if (trim_to == 0)
+  if (trim_to < get_first_committed())
     return;
 
-  if (g_conf->paxos_service_trim_min > 0) {
-    version_t first = get_first_committed();
-    if ((trim_to > 0) &&
-       trim_to > first &&
-       (trim_to - first) < (version_t)g_conf->paxos_service_trim_min)
-      return;  // not enough to trim
+  version_t to_remove = trim_to - get_first_committed();
+  if (g_conf->paxos_service_trim_min > 0 &&
+      to_remove < g_conf->paxos_service_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;
+    return;
   }
 
   dout(10) << __func__ << " trimming to " << trim_to << dendl;