]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: uninline should_trim()
authorSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 04:33:22 +0000 (21:33 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 04:33:22 +0000 (21:33 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/PaxosService.cc
src/mon/PaxosService.h

index 9330c56e7afd8daae270a1d476588be68e1ba37f..dca64360348a34e6386591dbc9754ee59644bf86 100644 (file)
@@ -326,6 +326,20 @@ void PaxosService::shutdown()
   finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
 }
 
+bool PaxosService::should_trim()
+{
+  if (!service_should_trim())
+    return false;
+
+  if (g_conf->paxos_service_trim_min > 0) {
+    version_t trim_to = get_trim_to();
+    version_t first = get_first_committed();
+    if ((trim_to > 0) && trim_to > first)
+      return ((trim_to - first) >= (version_t)g_conf->paxos_service_trim_min);
+   }
+  return true;
+}
+
 void PaxosService::trim(MonitorDBStore::Transaction *t,
                        version_t from, version_t to)
 {
index 3e5c69fb22fe33489f596a50698c97a529ff6302..18d95307ef4234f25f1261c7fcdef806dce490ed 100644 (file)
@@ -682,23 +682,10 @@ public:
   virtual void encode_trim_extra(MonitorDBStore::Transaction *tx, version_t first) {}
 
   /**
-   *
+   * decide whether we should trim service states
    */
-  virtual bool should_trim() {
-    bool want_trim = service_should_trim();
-
-    if (!want_trim)
-      return false;
-
-    if (g_conf->paxos_service_trim_min > 0) {
-      version_t trim_to = get_trim_to();
-      version_t first = get_first_committed();
+  bool should_trim();
 
-      if ((trim_to > 0) && trim_to > first)
-        return ((trim_to - first) >= (version_t)g_conf->paxos_service_trim_min);
-    }
-    return true;
-  }
   /**
    * Check if we should trim.
    *