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 2015/08/26 13:47:19 UTC

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

Author: mduerig
Date: Wed Aug 26 11:47:19 2015
New Revision: 1697891

URL: http://svn.apache.org/r1697891
Log:
OAK-3299: SNFE in SegmentOverflowExceptionIT
Only throw the exception after 100 retries failed.

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentOverflowExceptionIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentOverflowExceptionIT.java?rev=1697891&r1=1697890&r2=1697891&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentOverflowExceptionIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentOverflowExceptionIT.java Wed Aug 26 11:47:19 2015
@@ -120,16 +120,25 @@ public class SegmentOverflowExceptionIT
             });
 
             long start = System.currentTimeMillis();
+            int snfeCount = 0;
             while (System.currentTimeMillis() - start < TIMEOUT) {
-                NodeBuilder root = nodeStore.getRoot().builder();
-                while (rnd.nextInt(100) != 0) {
-                    modify(nodeStore, root);
-                }
-                nodeStore.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+                try {
+                    NodeBuilder root = nodeStore.getRoot().builder();
+                    while (rnd.nextInt(100) != 0) {
+                        modify(nodeStore, root);
+                    }
+                    nodeStore.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
 
-                if (compact) {
-                    compact = false;
-                    fileStore.maybeCompact(true);
+                    if (compact) {
+                        compact = false;
+                        fileStore.maybeCompact(true);
+                    }
+                } catch (SegmentNotFoundException snfe) {
+                    // Usually this can be ignored as SNFEs are somewhat expected here
+                    // due the small retention value for segments.
+                    if (snfeCount++ > 100) {
+                        throw snfe;
+                    }
                 }
             }
         } finally {