jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1564224 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/document/ test/java/org/apache/jackrabbit/oak/plugins/document/ test/java/org/apache/jackrabbit/oak/plugins/document/impl/ test/java/org/apache/ja...
Date Tue, 04 Feb 2014 07:44:16 GMT
Author: mreutegg
Date: Tue Feb  4 07:44:15 2014
New Revision: 1564224

URL: http://svn.apache.org/r1564224
Log:
OAK-1382: oak-core tests may run out of memory

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitQueueTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/DocumentMKConcurrentAddTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/command/ConcurrentWriteMultipleMkMongoTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ClusterPermissionsTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Tue Feb  4 07:44:15 2014
@@ -1606,6 +1606,9 @@ public final class DocumentNodeStore
                 if (nodeStore != null) {
                     nodeStore.runBackgroundOperations();
                     delay = nodeStore.getAsyncDelay();
+                } else {
+                    // node store not in use anymore
+                    break;
                 }
             }
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
Tue Feb  4 07:44:15 2014
@@ -53,6 +53,7 @@ public class BackgroundWriteTest {
             pending.put(p, r);
         }
         mk.runBackgroundOperations();
+        mk.dispose();
     }
 
     private static final class TestStore extends MemoryDocumentStore {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BlobReferenceTest.java
Tue Feb  4 07:44:15 2014
@@ -51,6 +51,7 @@ public class BlobReferenceTest {
             set.remove(b.toString());
         }
         assertTrue(set.isEmpty());
+        s.dispose();
     }
     
     static InputStream randomStream(int seed, int size) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitQueueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitQueueTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitQueueTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitQueueTest.java
Tue Feb  4 07:44:15 2014
@@ -103,6 +103,7 @@ public class CommitQueueTest {
         }
         running.set(false);
         observer.close();
+        store.dispose();
         for (Exception e : exceptions) {
             throw e;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
Tue Feb  4 07:44:15 2014
@@ -211,6 +211,9 @@ public class DocumentSplitTest extends B
             }
             previous = entry.getKey();
         }
+        mk1.dispose();
+        mk2.dispose();
+        mk3.dispose();
     }
 
     @Test // OAK-1233

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/DocumentMKConcurrentAddTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/DocumentMKConcurrentAddTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/DocumentMKConcurrentAddTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/DocumentMKConcurrentAddTest.java
Tue Feb  4 07:44:15 2014
@@ -25,7 +25,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.plugins.document.AbstractMongoConnectionTest;
 import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
 import org.apache.jackrabbit.oak.plugins.document.MongoUtils;
@@ -40,23 +39,23 @@ import com.mongodb.DB;
  */
 public class DocumentMKConcurrentAddTest extends AbstractMongoConnectionTest {
 
+    private static final int CACHE_SIZE = 8 * 1024 * 1024;
     private static final int NB_THREADS = 16;
 
-    private List<MongoConnection> connections = new ArrayList<MongoConnection>();
+    private List<DocumentMK> mks = new ArrayList<DocumentMK>();
 
-    private MicroKernel createMicroKernel() throws Exception {
+    private DocumentMK createMicroKernel() throws Exception {
         MongoConnection connection = MongoUtils.getConnection();
-        connections.add(connection);
         DB mongoDB = connection.getDB();
-        return new DocumentMK.Builder().setMongoDB(mongoDB).open();
+        return new DocumentMK.Builder().memoryCacheSize(CACHE_SIZE).setMongoDB(mongoDB).open();
     }
 
     @After
-    public void closeConnections() {
-        for (MongoConnection mc : connections) {
-            mc.close();
+    public void closeMKs() {
+        for (DocumentMK mk : mks) {
+            mk.dispose();
         }
-        connections.clear();
+        mks.clear();
     }
 
     /**
@@ -72,7 +71,8 @@ public class DocumentMKConcurrentAddTest
         List<Callable<String>> cs = new LinkedList<Callable<String>>();
         for (int i = 0; i < NB_THREADS; i++) {
             // each callable has its own microkernel
-            final MicroKernel mk = createMicroKernel();
+            final DocumentMK mk = createMicroKernel();
+            mks.add(mk);
             // diff for adding one node and one child node
             final List<String> stmts = new LinkedList<String>();
             stmts.add("+\"node" + i + "\":{}");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/command/ConcurrentWriteMultipleMkMongoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/command/ConcurrentWriteMultipleMkMongoTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/command/ConcurrentWriteMultipleMkMongoTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/impl/command/ConcurrentWriteMultipleMkMongoTest.java
Tue Feb  4 07:44:15 2014
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.document.impl.command;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -51,15 +53,20 @@ public class ConcurrentWriteMultipleMkMo
         String[] prefixes = new String[]{"a", "b", "c", "d", "e", "f"};
 
         ExecutorService executor = Executors.newFixedThreadPool(numberOfMks);
+        List<DocumentMK> mks = new ArrayList<DocumentMK>();
         for (int i = 0; i < numberOfMks; i++) {
             String diff = buildPyramidDiff("/", 0, numberOfChildren,
                     numberOfNodes, prefixes[i], new StringBuilder()).toString();
             DocumentMK mk = new DocumentMK.Builder().open();
+            mks.add(mk);
             GenericWriteTask task = new GenericWriteTask("mk-" + i, mk, diff, 10);
             executor.execute(task);
         }
         executor.shutdown();
         executor.awaitTermination(10, TimeUnit.MINUTES);
+        for (DocumentMK mk : mks) {
+            mk.dispose();
+        }
     }
 
     private StringBuilder buildPyramidDiff(String startingPoint,

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ClusterPermissionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ClusterPermissionsTest.java?rev=1564224&r1=1564223&r2=1564224&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ClusterPermissionsTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/ClusterPermissionsTest.java
Tue Feb  4 07:44:15 2014
@@ -51,6 +51,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -61,6 +62,8 @@ import static org.junit.Assert.assertTru
 
 public class ClusterPermissionsTest {
 
+    private DocumentMK mk1;
+    private DocumentMK mk2;
     private ContentRepository contentRepository1;
     private ContentRepository contentRepository2;
     private UserManager userManager1;
@@ -84,10 +87,10 @@ public class ClusterPermissionsTest {
 
         builder = new DocumentMK.Builder();
         builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
-        DocumentMK mk1 = builder.setClusterId(1).open();
+        mk1 = builder.setClusterId(1).open();
         builder = new DocumentMK.Builder();
         builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
-        DocumentMK mk2 = builder.setClusterId(2).open();
+        mk2 = builder.setClusterId(2).open();
 
         Oak oak = new Oak(mk1)
                 .with(new InitialContent())
@@ -119,6 +122,12 @@ public class ClusterPermissionsTest {
         aclMgr2 = securityProvider2.getConfiguration(AuthorizationConfiguration.class).getAccessControlManager(root2,
namePathMapper);
     }
 
+    @After
+    public void after() {
+        mk1.dispose();
+        mk2.dispose();
+    }
+
     protected ConfigurationParameters getSecurityConfigParameters() {
         return ConfigurationParameters.EMPTY;
     }



Mime
View raw message