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 2016/05/09 16:23:48 UTC

svn commit: r1742997 - /jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java

Author: mduerig
Date: Mon May  9 16:23:47 2016
New Revision: 1742997

URL: http://svn.apache.org/viewvc?rev=1742997&view=rev
Log:
OAK-4286: Rework failing tests in CompactionAndCleanupIT
Fix test propertyRetention to take into account generation based gc introduced with OAK-3348

Modified:
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java?rev=1742997&r1=1742996&r2=1742997&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java Mon May  9 16:23:47 2016
@@ -490,11 +490,12 @@ public class CompactionAndCleanupIT {
     }
 
     @Test
-    @Ignore
-    // FIXME OAK-4286: Rework failing tests in CompactionAndCleanupIT
-    // Fix failing test propertyRetention
     public void propertyRetention() throws IOException, CommitFailedException {
-        FileStore fileStore = FileStore.builder(getFileStoreFolder()).withMaxFileSize(1).build();
+        SegmentGCOptions gcOptions = SegmentGCOptions.DEFAULT;
+        FileStore fileStore = FileStore.builder(getFileStoreFolder())
+                .withMaxFileSize(1)
+                .withGCOptions(gcOptions)
+                .build();
         try {
             final SegmentNodeStore nodeStore = SegmentNodeStore.builder(fileStore).build();
 
@@ -506,6 +507,7 @@ public class CompactionAndCleanupIT {
             // Segment id of the current segment
             NodeState test = nodeStore.getRoot().getChildNode("test");
             SegmentId id = ((SegmentNodeState) test).getRecordId().getSegmentId();
+            fileStore.flush();
             assertTrue(fileStore.containsSegment(id));
 
             // Add enough content to fill up the current tar file
@@ -520,7 +522,11 @@ public class CompactionAndCleanupIT {
 
             // GC should remove the segment
             fileStore.flush();
-            fileStore.compact();
+            // Ensure cleanup is efficient by surpassing the number of
+            // retained generations
+            for (int k = 0; k < gcOptions.getRetainedGenerations(); k++) {
+                fileStore.compact();
+            }
             fileStore.cleanup();
 
             try {