Author: mduerig
Date: Wed Dec  9 16:45:43 2015
New Revision: 1718901

URL: http://svn.apache.org/viewvc?rev=1718901&view=rev
Log:
OAK-3760: Compaction progress logger: reported number of nodes and binaries is 
too high
Place onNode and onBinary calls such that only items actually compacted are 
accounted for and not such that are merely deduplicated

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

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java?rev=1718901&r1=1718900&r2=1718901&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
 Wed Dec  9 16:45:43 2015
@@ -224,7 +224,7 @@ public class Compactor {
             if (path != null) {
                 log.trace("childNodeAdded {}/{}", path, name);
             }
-            progress.onNode();
+
             RecordId id = null;
             if (after instanceof SegmentNodeState) {
                 id = ((SegmentNodeState) after).getRecordId();
@@ -235,6 +235,7 @@ public class Compactor {
                 }
             }
 
+            progress.onNode();
             NodeBuilder child = EmptyNodeState.EMPTY_NODE.builder();
             boolean success = EmptyNodeState.compareAgainstEmptyState(after,
                     newCompactionDiff(child, path, name));
@@ -256,7 +257,6 @@ public class Compactor {
             if (path != null) {
                 log.trace("childNodeChanged {}/{}", path, name);
             }
-            progress.onNode();
 
             RecordId id = null;
             if (after instanceof SegmentNodeState) {
@@ -268,6 +268,7 @@ public class Compactor {
                 }
             }
 
+            progress.onNode();
             NodeBuilder child = builder.getChildNode(name);
             boolean success = after.compareAgainstBaseState(before,
                     newCompactionDiff(child, path, name));
@@ -320,15 +321,16 @@ public class Compactor {
     private Blob compact(Blob blob) {
         if (blob instanceof SegmentBlob) {
             SegmentBlob sb = (SegmentBlob) blob;
-            progress.onBinary();
             try {
-                // else check if we've already cloned this specific record
+                // Check if we've already cloned this specific record
                 RecordId id = sb.getRecordId();
                 RecordId compactedId = map.get(id);
                 if (compactedId != null) {
                     return new SegmentBlob(compactedId);
                 }
 
+                progress.onBinary();
+
                 // if the blob is inlined or external, just clone it
                 if (sb.isExternal() || sb.length() < Segment.MEDIUM_LIMIT) {
                     SegmentBlob clone = sb.clone(writer, cloneBinaries);


Reply via email to