ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-6737 GridDeploymentPerVersionStore retries loading class infinitely. This fixes #2934
Date Wed, 08 Nov 2017 08:13:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/master a58393d01 -> f52f8f926


IGNITE-6737 GridDeploymentPerVersionStore retries loading class infinitely. This fixes #2934


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

Branch: refs/heads/master
Commit: f52f8f9260e7cd06ac9a3d5974cb1fac0c29ab2f
Parents: a58393d
Author: vd-pyatkov <vpyatkov@gridgain.com>
Authored: Wed Nov 8 11:12:48 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Nov 8 11:12:48 2017 +0300

----------------------------------------------------------------------
 .../GridDeploymentPerVersionStore.java          |   8 +-
 .../p2p/DeploymentClassLoaderCallableTest.java  | 127 +++++++++++++++++++
 .../testsuites/IgniteP2PSelfTestSuite.java      |   2 +
 .../tests/p2p/compute/ExternalCallable.java     |  38 ++++++
 .../tests/p2p/compute/ExternalCallable1.java    |  39 ++++++
 .../tests/p2p/compute/ExternalCallable2.java    |  39 ++++++
 6 files changed, 251 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
index 0bf8328..070b390 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
@@ -544,8 +544,12 @@ public class GridDeploymentPerVersionStore extends GridDeploymentStoreAdapter
{
 
                         // New deployment was added while outside of synchronization.
                         // Need to recheck it again.
-                        if (!d.pendingUndeploy() && !d.undeployed() && !depsToCheck.contains(d))
-                            retry = true;
+                        if (!d.pendingUndeploy() && !d.undeployed() && !depsToCheck.contains(d))
{
+                            Map<UUID, IgniteUuid> parties = d.participants();
+
+                            if (parties == null || parties.get(meta.senderNodeId()) == null)
+                                retry = true;
+                        }
                     }
 
                     if (retry) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/core/src/test/java/org/apache/ignite/p2p/DeploymentClassLoaderCallableTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/p2p/DeploymentClassLoaderCallableTest.java
b/modules/core/src/test/java/org/apache/ignite/p2p/DeploymentClassLoaderCallableTest.java
new file mode 100644
index 0000000..a9cec68
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/p2p/DeploymentClassLoaderCallableTest.java
@@ -0,0 +1,127 @@
+package org.apache.ignite.p2p;
+
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.testframework.GridTestExternalClassLoader;
+import org.apache.ignite.testframework.config.GridTestProperties;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ */
+public class DeploymentClassLoaderCallableTest extends GridCommonAbstractTest {
+    /** */
+    private static final String RUN_CLS = "org.apache.ignite.tests.p2p.compute.ExternalCallable";
+
+    /** */
+    private static final String RUN_CLS1 = "org.apache.ignite.tests.p2p.compute.ExternalCallable1";
+
+    /** */
+    private static final String RUN_CLS2 = "org.apache.ignite.tests.p2p.compute.ExternalCallable2";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setPeerClassLoadingEnabled(true);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testDeploymentFromSecondAndThird() throws Exception {
+        try {
+            startGrid(1);
+
+            final Ignite ignite2 = startGrid(2);
+            final Ignite ignite3 = startGrid(3);
+
+            runJob0(ignite2, 10_000);
+
+            runJob1(ignite3, 10_000);
+            runJob2(ignite3, 10_000);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testDeploymentFromEach() throws Exception {
+        try {
+            final Ignite ignite1 = startGrid(1);
+            final Ignite ignite2 = startGrid(2);
+            final Ignite ignite3 = startGrid(3);
+
+            runJob0(ignite1, 10_000);
+
+            runJob1(ignite2, 10_000);
+
+            runJob2(ignite3, 10_000);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testDeploymentFromOne() throws Exception {
+        try {
+            startGrid(1);
+            startGrid(2);
+
+            final Ignite ignite3 = startGrid(3);
+
+            runJob0(ignite3, 10_000);
+            runJob1(ignite3, 10_000);
+            runJob2(ignite3, 10_000);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @param ignite Ignite instance.
+     * @param timeout Timeout.
+     * @throws Exception If failed.
+     */
+    private void runJob1(Ignite ignite, long timeout) throws Exception {
+        ClassLoader testClassLoader1 = new GridTestExternalClassLoader(new URL[] {
+            new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS, RUN_CLS2);
+
+        Constructor ctor = testClassLoader1.loadClass(RUN_CLS1).getConstructor();
+        ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<?>)ctor.newInstance());
+    }
+
+    /**
+     * @param ignite Ignite instance.
+     * @param timeout Timeout.
+     * @throws Exception If failed.
+     */
+    private void runJob0(Ignite ignite, long timeout) throws Exception {
+        ClassLoader testClassLoader = new GridTestExternalClassLoader(new URL[] {
+            new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS1, RUN_CLS2);
+
+        Constructor ctor = testClassLoader.loadClass(RUN_CLS).getConstructor();
+        ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<?>)ctor.newInstance());
+    }
+
+    /**
+     * @param ignite Ignite instance.
+     * @param timeout Timeout.
+     * @throws Exception If failed.
+     */
+    private void runJob2(Ignite ignite, long timeout) throws Exception {
+        ClassLoader testClassLoader = new GridTestExternalClassLoader(new URL[] {
+            new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS, RUN_CLS1);
+
+        Constructor ctor = testClassLoader.loadClass(RUN_CLS2).getConstructor();
+        ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<?>)ctor.newInstance());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
index 7bade98..abd9967 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testsuites;
 import java.util.Set;
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.managers.deployment.GridDeploymentMessageCountSelfTest;
+import org.apache.ignite.p2p.DeploymentClassLoaderCallableTest;
 import org.apache.ignite.p2p.GridP2PClassLoadingSelfTest;
 import org.apache.ignite.p2p.GridP2PContinuousDeploymentSelfTest;
 import org.apache.ignite.p2p.GridP2PDifferentClassLoaderSelfTest;
@@ -70,6 +71,7 @@ public class IgniteP2PSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridP2PTimeoutSelfTest.class));
         suite.addTest(new TestSuite(GridP2PMissedResourceCacheSizeSelfTest.class));
         suite.addTest(new TestSuite(GridP2PContinuousDeploymentSelfTest.class));
+        suite.addTest(new TestSuite(DeploymentClassLoaderCallableTest.class));
         GridTestUtils.addTestIfNeeded(suite, GridDeploymentMessageCountSelfTest.class, ignoredTests);
 
         return suite;

http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
new file mode 100644
index 0000000..16ce493
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
@@ -0,0 +1,38 @@
+package org.apache.ignite.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ */
+public class ExternalCallable implements IgniteCallable {
+    /** */
+    @IgniteInstanceResource
+    Ignite ignite;
+
+    /** */
+    private int param;
+
+    /**
+     */
+    public ExternalCallable() {
+        // No-op.
+    }
+
+    /**
+     * @param param Param.
+     */
+    public ExternalCallable(int param) {
+        this.param = param;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object call() {
+        System.err.println("!!!!! I am job " + param + " on " + ignite.name());
+
+        return  42;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
new file mode 100644
index 0000000..f7bd8a7
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
@@ -0,0 +1,39 @@
+package org.apache.ignite.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ */
+public class ExternalCallable1 implements IgniteCallable {
+    /** */
+    @IgniteInstanceResource
+    Ignite ignite;
+
+    /** */
+    private int param;
+
+    /**
+     *
+     */
+    public ExternalCallable1() {
+        // No-op.
+    }
+
+    /**
+     * @param param Param.
+     */
+    public ExternalCallable1(int param) {
+        this.param = param;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object call() {
+        System.err.println("!!!!! I am job_1 " + param + " on " + ignite.name());
+
+        return 42;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/f52f8f92/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
new file mode 100644
index 0000000..7a09f9d
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
@@ -0,0 +1,39 @@
+package org.apache.ignite.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ */
+public class ExternalCallable2 implements IgniteCallable {
+    /** */
+    @IgniteInstanceResource
+    Ignite ignite;
+
+    /** */
+    private int param;
+
+    /**
+     *
+     */
+    public ExternalCallable2() {
+        // No-op.
+    }
+
+    /**
+     * @param param Param.
+     */
+    public ExternalCallable2(int param) {
+        this.param = param;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object call() {
+        System.err.println("!!!!! I am job_2 " + param + " on " + ignite.name());
+
+        return 42;
+    }
+}
+
+


Mime
View raw message