ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [02/43] ignite git commit: IGNITE-4712 Memory leaks in PageMemory
Date Fri, 10 Mar 2017 07:23:23 GMT
IGNITE-4712 Memory leaks in PageMemory


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/95faf450
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/95faf450
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/95faf450

Branch: refs/heads/ignite-4712
Commit: 95faf450cbbf6be4887965209bec3ae0244bcdd9
Parents: 4376f82
Author: Igor Seliverstov <gvvinblade@gmail.com>
Authored: Mon Feb 20 18:11:34 2017 +0300
Committer: Igor Seliverstov <gvvinblade@gmail.com>
Committed: Tue Feb 21 12:44:29 2017 +0300

----------------------------------------------------------------------
 .../IgniteDbMemoryLeakAbstractTest.java         | 24 ++++++++------------
 .../IgniteDbMemoryLeakLargeObjectsTest.java     |  8 -------
 .../IgniteDbMemoryLeakLargePagesTest.java       |  9 --------
 .../database/IgniteDbMemoryLeakTest.java        |  8 -------
 .../IgniteDbMemoryLeakWithExpirationTest.java   |  1 -
 .../database/IgniteDbMemoryLeakIndexedTest.java |  9 --------
 6 files changed, 10 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
index d939311..bef1320 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
@@ -18,13 +18,13 @@
 package org.apache.ignite.internal.processors.database;
 
 import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.processors.cache.database.DataStructure;
-import org.apache.ignite.internal.util.GridRandom;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -33,6 +33,10 @@ import org.jetbrains.annotations.NotNull;
 public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTest {
     /** */
     @SuppressWarnings("WeakerAccess") protected static final int CONCURRENCY_LEVEL = 8;
+
+    /** */
+    private static final int MIN_PAGE_CACHE_SIZE = 1048576 * CONCURRENCY_LEVEL;
+
     /** */
     private volatile Exception ex = null;
 
@@ -51,9 +55,6 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
     /** */
     private long probeCnt = 0;
 
-    /** */
-    private static final ThreadLocal<Random> THREAD_LOCAL_RANDOM = new ThreadLocal<>();
-
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
         DataStructure.rnd = null;
@@ -71,6 +72,9 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
     /** {@inheritDoc} */
     @Override protected void configure(MemoryConfiguration mCfg) {
         mCfg.setConcurrencyLevel(CONCURRENCY_LEVEL);
+
+        long size = 1024 * pagesMax() * (isLargePage() ? 16 : 1);
+        mCfg.setPageCacheSize(Math.max(size, MIN_PAGE_CACHE_SIZE));
     }
 
     /**
@@ -81,7 +85,7 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
     }
 
     /**
-     * @return Warm up duration.
+     * @return Warm up duration in seconds.
      */
     @SuppressWarnings("WeakerAccess") protected int warmUp() {
         return 300;
@@ -144,21 +148,13 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
      * @return Random.
      */
     @NotNull protected static Random getRandom() {
-        Random rnd = THREAD_LOCAL_RANDOM.get();
-
-        if (rnd == null) {
-            rnd = new GridRandom();
-            THREAD_LOCAL_RANDOM.set(rnd);
-        }
-
-        return rnd;
+        return ThreadLocalRandom.current();
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testMemoryLeak() throws Exception {
-
         final IgniteEx ignite = grid(0);
         final IgniteCache<Object, Object> cache = cache(ignite);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargeObjectsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargeObjectsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargeObjectsTest.java
index 0fa9096..3aab102 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargeObjectsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargeObjectsTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.database;
 
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 
 /**
@@ -36,13 +35,6 @@ public class IgniteDbMemoryLeakLargeObjectsTest extends IgniteDbMemoryLeakAbstra
     }
 
     /** {@inheritDoc} */
-    @Override protected void configure(MemoryConfiguration mCfg) {
-        super.configure(mCfg);
-
-        mCfg.setPageCacheSize(35840000); // The space for 35000 pages
-    }
-
-    /** {@inheritDoc} */
     @Override protected IgniteCache<Object, Object> cache(IgniteEx ig) {
         return ig.cache("large");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargePagesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargePagesTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargePagesTest.java
index 9dd9fdc..540681d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargePagesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakLargePagesTest.java
@@ -17,20 +17,11 @@
 
 package org.apache.ignite.internal.processors.database;
 
-import org.apache.ignite.configuration.MemoryConfiguration;
-
 /**
  *
  */
 public class IgniteDbMemoryLeakLargePagesTest extends IgniteDbMemoryLeakTest {
     /** {@inheritDoc} */
-    @Override protected void configure(MemoryConfiguration mCfg) {
-        super.configure(mCfg);
-
-        mCfg.setPageCacheSize(67108864); // The space for 4000 large pages
-    }
-
-    /** {@inheritDoc} */
     @Override protected boolean isLargePage() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakTest.java
index 94e419d..30ff18f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.database;
 
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 
 /**
@@ -26,13 +25,6 @@ import org.apache.ignite.internal.IgniteEx;
  */
 public class IgniteDbMemoryLeakTest extends IgniteDbMemoryLeakAbstractTest {
     /** {@inheritDoc} */
-    @Override protected void configure(MemoryConfiguration mCfg) {
-        super.configure(mCfg);
-
-        mCfg.setPageCacheSize(20971520); // The space for 20000 pages
-    }
-
-    /** {@inheritDoc} */
     @Override protected IgniteCache<Object, Object> cache(IgniteEx ig) {
         return ig.cache("non-primitive");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakWithExpirationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakWithExpirationTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakWithExpirationTest.java
index c1e279b..212daa1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakWithExpirationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakWithExpirationTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.database;
 
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 
 import javax.cache.expiry.CreatedExpiryPolicy;

http://git-wip-us.apache.org/repos/asf/ignite/blob/95faf450/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakIndexedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakIndexedTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakIndexedTest.java
index c917bc1..f6a06c9 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakIndexedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakIndexedTest.java
@@ -17,20 +17,11 @@
 
 package org.apache.ignite.internal.processors.database;
 
-import org.apache.ignite.configuration.MemoryConfiguration;
-
 /**
  *
  */
 public class IgniteDbMemoryLeakIndexedTest extends IgniteDbMemoryLeakTest {
     /** {@inheritDoc} */
-    @Override protected void configure(MemoryConfiguration mCfg) {
-        super.configure(mCfg);
-
-        mCfg.setPageCacheSize(25165824); // The space for 24000 pages
-    }
-
-    /** {@inheritDoc} */
     @Override protected boolean indexingEnabled() {
         return true;
     }


Mime
View raw message