You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/08/25 08:39:57 UTC

[15/18] ignite git commit: ignite-6175 JVM Crash in Ignite Binary Objects Simple Mapper Basic suite

ignite-6175 JVM Crash in Ignite Binary Objects Simple Mapper Basic suite

Signed-off-by: Andrey Gura <ag...@apache.org>


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

Branch: refs/heads/ignite-6149
Commit: 24306badde225ee4b3edec53b2ae8d3e1c0bff8d
Parents: 3ab523c
Author: EdShangGG <es...@gridgain.com>
Authored: Thu Aug 24 19:15:24 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Thu Aug 24 19:15:24 2017 +0300

----------------------------------------------------------------------
 .../processors/database/BPlusTreeSelfTest.java  | 39 +++++++++++++++-----
 1 file changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/24306bad/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index 4a32df2..9c0d791 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridRandom;
 import org.apache.ignite.internal.util.GridStripedLock;
 import org.apache.ignite.internal.util.IgniteTree;
+import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.SB;
@@ -112,11 +113,11 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
     /** */
     private static final Collection<Long> rmvdIds = new GridConcurrentHashSet<>();
 
+    /** Stop. */
+    private final AtomicBoolean stop = new AtomicBoolean();
 
-//    /** {@inheritDoc} */
-//    @Override protected long getTestTimeout() {
-//        return 25 * 60 * 1000;
-//    }
+    /** Future. */
+    private volatile GridCompoundFuture<?, ?> asyncRunFut;
 
     /**
      * Check that we do not keep any locks at the moment.
@@ -127,6 +128,8 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
+        stop.set(false);
+
         long seed = System.nanoTime();
 
         X.println("Test seed: " + seed + "L; // ");
@@ -156,6 +159,18 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
         rnd = null;
 
         try {
+            if (asyncRunFut != null && !asyncRunFut.isDone()) {
+                stop.set(true);
+
+                try {
+                    asyncRunFut.cancel();
+                    asyncRunFut.get(60000);
+                }
+                catch (Throwable ex) {
+                    //Ignore
+                }
+            }
+
             if (reuseList != null) {
                 long size = reuseList.recycledPagesCount();
 
@@ -1316,7 +1331,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
 
         IgniteInternalFuture<?> fut = multithreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                for (int i = 0; i < loops; i++) {
+                for (int i = 0; i < loops && !stop.get(); i++) {
                     final Long x = (long)DataStructure.randomInt(CNT);
                     final int op = DataStructure.randomInt(4);
 
@@ -1402,8 +1417,6 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
             }
         }, Runtime.getRuntime().availableProcessors(), "put-remove");
 
-        final AtomicBoolean stop = new AtomicBoolean();
-
         IgniteInternalFuture<?> fut2 = multithreadedAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
                 while (!stop.get()) {
@@ -1442,14 +1455,22 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
             }
         }, 4, "find");
 
+
+        asyncRunFut = new GridCompoundFuture<>();
+
+        asyncRunFut.add((IgniteInternalFuture)fut);
+        asyncRunFut.add((IgniteInternalFuture)fut2);
+        asyncRunFut.add((IgniteInternalFuture)fut3);
+
+        asyncRunFut.markInitialized();
+
         try {
             fut.get(getTestTimeout(), TimeUnit.MILLISECONDS);
         }
         finally {
             stop.set(true);
 
-            fut2.get();
-            fut3.get();
+            asyncRunFut.get();
         }
 
         GridCursor<Long> cursor = tree.find(null, null);