You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2015/07/23 11:28:22 UTC

svn commit: r1692366 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java

Author: mduerig
Date: Thu Jul 23 09:28:21 2015
New Revision: 1692366

URL: http://svn.apache.org/r1692366
Log:
OAK-3125: Skip compaction estimation if threshold is 0
Avoid logging estimation result twice

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1692366&r1=1692365&r2=1692366&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java Thu Jul 23 09:28:21 2015
@@ -464,37 +464,27 @@ public class FileStore implements Segmen
         if (gainThreshold > 0) {
             CompactionGainEstimate estimate = estimateCompactionGain();
             long gain = estimate.estimateCompactionGain(offset);
-            gcMonitor
-                    .info("Estimated compaction in {}, gain is {}% ({}/{}) or ({}/{}), so running compaction",
-                            watch,
-                            gain,
-                            estimate.getReachableSize(),
-                            estimate.getTotalSize(),
-                            humanReadableByteCount(estimate.getReachableSize()),
-                            humanReadableByteCount(estimate.getTotalSize()));
             runCompaction = gain >= gainThreshold;
-            if (!runCompaction) {
+            if (runCompaction) {
+                gcMonitor.info(
+                    "Estimated compaction in {}, gain is {}% ({}/{}) or ({}/{}), so running compaction",
+                    watch, gain, estimate.getReachableSize(), estimate.getTotalSize(),
+                    humanReadableByteCount(estimate.getReachableSize()), humanReadableByteCount(estimate.getTotalSize()));
+            } else {
                 if (estimate.getTotalSize() == 0) {
-                    gcMonitor
-                            .skipped(
-                                    "Estimated compaction in {}. Skipping compaction for now as repository consists of a single tar file only",
-                                    watch);
+                    gcMonitor.skipped(
+                        "Estimated compaction in {}. Skipping compaction for now as repository consists " +
+                        "of a single tar file only", watch);
                 } else {
-                    gcMonitor
-                            .skipped(
-                                    "Estimated compaction in {}, gain is {}% ({}/{}) or ({}/{}), so skipping compaction for now",
-                                    watch, gain, estimate.getReachableSize(),
-                                    estimate.getTotalSize(),
-                                    humanReadableByteCount(estimate
-                                            .getReachableSize()),
-                                    humanReadableByteCount(estimate
-                                            .getTotalSize()));
+                    gcMonitor.skipped(
+                        "Estimated compaction in {}, gain is {}% ({}/{}) or ({}/{}), so skipping compaction for now",
+                        watch, gain, estimate.getReachableSize(), estimate.getTotalSize(),
+                        humanReadableByteCount(estimate.getReachableSize()), humanReadableByteCount(estimate.getTotalSize()));
                 }
             }
         } else {
-            gcMonitor
-                    .info("Compaction estimation is skipped due to threshold value ({}).",
-                            gainThreshold);
+            gcMonitor.info("Compaction estimation is skipped due to threshold value ({}). Running compaction",
+                gainThreshold);
         }
 
         if (runCompaction) {