jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1593213 - in /jackrabbit/oak/trunk: oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jac...
Date Thu, 08 May 2014 09:12:22 GMT
Author: mduerig
Date: Thu May  8 09:12:22 2014
New Revision: 1593213

URL: http://svn.apache.org/r1593213
Log:
OAK-1491: ObservationTest failure on Windows
- ObservationTest: fix timeout on slow machines by increasing timeout and disabling parallel
test execution
- BackgroundObserverTest, ObservationRefreshTest: ensure observation revision queue is large
enough to hold all items waited for as otherwise we end up in a deadlock when queue compacting
kicks in as the pending events would only be generated on a subsequent commit.
- CompatibilityIssueTest: fix timeout on slow machines by increasing timeout

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserverTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationRefreshTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserverTest.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserverTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserverTest.java
Thu May  8 09:12:22 2014
@@ -40,6 +40,7 @@ import org.junit.Test;
 
 public class BackgroundObserverTest {
     private static final CommitInfo COMMIT_INFO = new CommitInfo("no-session", null);
+    public static final int CHANGE_COUNT = 1024;
 
     private final List<Runnable> assertions = Lists.newArrayList();
     private CountDownLatch doneCounter;
@@ -52,7 +53,7 @@ public class BackgroundObserverTest {
     public void concurrentObservers() throws InterruptedException {
         Observer observer = createCompositeObserver(newFixedThreadPool(16), 128);
 
-        for (int k = 0; k < 1024; k++) {
+        for (int k = 0; k < CHANGE_COUNT; k++) {
             contentChanged(observer, k);
         }
         done(observer);
@@ -90,6 +91,11 @@ public class BackgroundObserverTest {
     }
 
     private Observer createBackgroundObserver(ExecutorService executor) {
+        // Ensure the observation revision queue is sufficiently large to hold
+        // all revisions. Otherwise waiting for events might block since pending
+        // events would only be released on a subsequent commit. See OAK-1491
+        int queueLength = CHANGE_COUNT + 1;
+
         return new BackgroundObserver(new Observer() {
             // Need synchronised list here to maintain correct memory barrier
             // when this is passed on to done(List<Runnable>)
@@ -117,7 +123,7 @@ public class BackgroundObserverTest {
             private Long getP(NodeState previous) {
                 return previous.getProperty("p").getValue(Type.LONG);
             }
-        }, executor, 1024);
+        }, executor, queueLength);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java Thu
May  8 09:12:22 2014
@@ -56,7 +56,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 public class Jcr {
-    private static final int DEFAULT_OBSERVATION_QUEUE_LENGTH = 1000;
+    public static final int DEFAULT_OBSERVATION_QUEUE_LENGTH = 1000;
 
     private final Oak oak;
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
Thu May  8 09:12:22 2014
@@ -53,6 +53,7 @@ public abstract class AbstractRepository
     private NodeStore nodeStore;
     private Repository repository;
     private Session adminSession;
+    protected int observationQueueLength = Jcr.DEFAULT_OBSERVATION_QUEUE_LENGTH;
 
     /**
      * The system property "ns-fixtures" can be used to provide a
@@ -118,7 +119,9 @@ public abstract class AbstractRepository
     protected Repository getRepository() {
         if (repository == null) {
             nodeStore = fixture.createNodeStore();
-            repository  = new Jcr(nodeStore).createRepository();
+            repository  = new Jcr(nodeStore)
+                    .withObservationQueueLength(observationQueueLength)
+                    .createRepository();
         }
         return repository;
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
Thu May  8 09:12:22 2014
@@ -325,7 +325,7 @@ public class CompatibilityIssuesTest ext
             session.getNode(testNodePath).setProperty("foo2","bar2");
             session.save();
 
-            latch.await(10,TimeUnit.SECONDS);
+            latch.await(60, TimeUnit.SECONDS);
 
             //Only one event is recorded for foo2 modification
             assertEquals(1,events.size());

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationRefreshTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationRefreshTest.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationRefreshTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationRefreshTest.java
Thu May  8 09:12:22 2014
@@ -78,6 +78,10 @@ public class ObservationRefreshTest exte
 
     @Before
     public void setup() throws RepositoryException {
+        // Ensure the observation revision queue is sufficiently large to hold
+        // all revisions. Otherwise waiting for events might block since pending
+        // events would only be released on a subsequent commit. See OAK-1491
+        observationQueueLength = 1000000;
         Session session = getAdminSession();
 
         NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java?rev=1593213&r1=1593212&r2=1593213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
Thu May  8 09:12:22 2014
@@ -77,7 +77,11 @@ import org.apache.jackrabbit.oak.plugins
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
+@RunWith(Parameterized.class)
+// Don't run "Parallelized" as this causes tests to timeout in "weak" environments
 public class ObservationTest extends AbstractRepositoryTest {
     public static final int ALL_EVENTS = NODE_ADDED | NODE_REMOVED | NODE_MOVED | PROPERTY_ADDED
|
             PROPERTY_REMOVED | PROPERTY_CHANGED | PERSIST;
@@ -85,7 +89,7 @@ public class ObservationTest extends Abs
     private static final String REFERENCEABLE_NODE = "\"referenceable\"";
     private static final String TEST_PATH = '/' + TEST_NODE;
     private static final String TEST_TYPE = "mix:test";
-    public static final int TIME_OUT = 4;
+    public static final int TIME_OUT = 60;
 
     private Session observingSession;
     private ObservationManager observationManager;
@@ -460,7 +464,7 @@ public class ObservationTest extends Abs
         }).get(10, TimeUnit.SECONDS);
 
         // Make sure we see no more events
-        assertFalse(noEvents.wait(TIME_OUT, TimeUnit.SECONDS));
+        assertFalse(noEvents.wait(4, TimeUnit.SECONDS));
     }
 
     @Test
@@ -927,10 +931,6 @@ public class ObservationTest extends Abs
                 Futures.allAsList(expected).get(time, timeUnit);
             }
             catch (TimeoutException e) {
-                long dt = System.nanoTime() - t0;
-                // TODO remove again once OAK-1491 is fixed
-                assertTrue("Spurious wak-up after " + dt,
-                        dt > 0.8*TimeUnit.NANOSECONDS.convert(time, timeUnit));
                 for (Expectation exp : expected) {
                     if (!exp.isDone()) {
                         missing.add(exp);



Mime
View raw message