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 ch...@apache.org on 2014/05/21 07:43:04 UTC

svn commit: r1596474 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java

Author: chetanm
Date: Wed May 21 05:43:03 2014
New Revision: 1596474

URL: http://svn.apache.org/r1596474
Log:
OAK-1817 - NPE in MarkSweepGarbageCollector.saveBatchToFile during Datastore GC with FileDataStore

Modified the testcase which reproduces the original issue. Looks like creating large number of blob causes issue with blob ref accounting logic

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java?rev=1596474&r1=1596473&r2=1596474&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java Wed May 21 05:43:03 2014
@@ -44,6 +44,7 @@ import java.util.List;
 import java.util.Random;
 
 import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
@@ -81,6 +82,7 @@ public class ExternalBlobTest {
         is.close();
     }
 
+    @Ignore("OAK-1817")
     @Test
     public void testNullBlobId() throws Exception{
         FileDataStore fds = createFileDataStore();
@@ -90,8 +92,14 @@ public class ExternalBlobTest {
         NodeBuilder nb = nodeStore.getRoot().builder();
         NodeBuilder cb = nb.child("hello");
         cb.setProperty("blob1", createBlob(Segment.MEDIUM_LIMIT - 1));
-        cb.setProperty("blob2", createBlob(Segment.MEDIUM_LIMIT + 1));
-        cb.setProperty("blob3", createBlob(Segment.MEDIUM_LIMIT + 1));
+
+        int noOfBlobs = 4000;
+        for(int i = 0; i < noOfBlobs; i++){
+            cb.setProperty("blob"+i, createBlob(Segment.MEDIUM_LIMIT+1));
+        }
+
+        cb.setProperty("anotherBlob2", createBlob(Segment.MEDIUM_LIMIT + 1));
+        cb.setProperty("anotherBlob3", createBlob(Segment.MEDIUM_LIMIT + 1));
         nodeStore.merge(nb, EmptyHook.INSTANCE, CommitInfo.EMPTY);
 
         final List<String> refrences = Lists.newArrayList();
@@ -102,6 +110,8 @@ public class ExternalBlobTest {
                 refrences.add(reference);
             }
         });
+
+        assertEquals(noOfBlobs + 2, refrences.size());
     }
 
     private Blob testCreateAndRead(Blob blob) throws Exception {