Author: jukka
Date: Thu Jun 26 05:32:25 2014
New Revision: 1605670

URL: http://svn.apache.org/r1605670
Log:
OAK-1917: FileNotFoundException during TarMK GC

The "graph != null" condition from OAK-1780 should only be used to force
the rewriting of an old tar file when that tar file still contains some
referenceable content, not when the entire file can be removed.

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

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java?rev=1605670&r1=1605669&r2=1605670&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java
 Thu Jun 26 05:32:25 2014
@@ -611,14 +611,15 @@ class TarReader {
         size += getEntrySize(24 * count + 16);
         size += 2 * BLOCK_SIZE;
 
-        if (graph != null) {
-            if (count == 0) {
-                // none of the entries within this tar file are referenceable
-                return null;
-            } else if (size >= access.length() * 3 / 4) {
-                // the space savings are not worth it at less than 25%
-                return this;
-            }
+        if (count == 0) {
+            // none of the entries within this tar file are referenceable
+            return null;
+        } else if (size >= access.length() * 3 / 4 && graph != null) {
+            // the space savings are not worth it at less than 25%,
+            // unless this tar file lacks a pre-compiled segment graph
+            // in which case we'll always generate a new tar file with
+            // the graph to speed up future garbage collection runs.
+            return this;
         }
 
         String name = file.getName();


Reply via email to