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 2017/08/18 15:13:12 UTC

svn commit: r1805435 - /jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java

Author: mduerig
Date: Fri Aug 18 15:13:12 2017
New Revision: 1805435

URL: http://svn.apache.org/viewvc?rev=1805435&view=rev
Log:
OAK-6553: Progress indicator for compaction
Add estimated percentage of completion when available

Modified:
    jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java?rev=1805435&r1=1805434&r2=1805435&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java Fri Aug 18 15:13:12 2017
@@ -101,8 +101,8 @@ public class GCNodeWriteMonitor {
     public synchronized void onNode() {
         nodes++;
         if (gcProgressLog > 0 && nodes % gcProgressLog == 0) {
-            gcMonitor.info("TarMK GC #{}: compacted {} nodes, {} properties, {} binaries in {} ms.",
-                    gcCount, nodes, properties, binaries, System.currentTimeMillis() - start);
+            gcMonitor.info("TarMK GC #{}: compacted {} nodes, {} properties, {} binaries in {} ms. {}",
+                    gcCount, nodes, properties, binaries, System.currentTimeMillis() - start, getPercentageDone());
         }
     }
 
@@ -133,6 +133,13 @@ public class GCNodeWriteMonitor {
         return estimated;
     }
 
+    @Nonnull
+    private String getPercentageDone() {
+        return estimated > 0
+            ? getEstimatedPercentage() + "% complete."
+            : "";
+    }
+
     /**
      * Estimated completion percentage. Can be {@code -1} if the estimation
      * could not be performed.