ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [07/15] ignite git commit: IGNITE-1384 Fixed
Date Wed, 04 May 2016 14:38:42 GMT
IGNITE-1384 Fixed


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

Branch: refs/heads/ignite-db-x-10884
Commit: 01f12a238e075ae82232e4fa5e80ba109130e14c
Parents: 6c705da
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Fri Apr 29 14:46:41 2016 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Fri Apr 29 14:46:41 2016 +0300

----------------------------------------------------------------------
 .../processors/task/GridTaskWorker.java         |  2 +-
 .../java/org/apache/ignite/lang/IgniteUuid.java |  2 +-
 .../internal/GridTaskExecutionSelfTest.java     | 76 +++++++++++++++++++-
 3 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/01f12a23/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 659d5a6..05970ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -558,7 +558,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject
{
             if (node == null)
                 throw new IgniteCheckedException("Node can not be null [mappedJob=" + mappedJob
+ ", ses=" + ses + ']');
 
-            IgniteUuid jobId = IgniteUuid.fromUuid(node.id());
+            IgniteUuid jobId = IgniteUuid.fromUuid(ctx.localNodeId());
 
             GridJobSiblingImpl sib = new GridJobSiblingImpl(ses.getId(), jobId, node.id(),
ctx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01f12a23/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
index 5c6bb9a..7de389e 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
@@ -216,4 +216,4 @@ public final class IgniteUuid implements Comparable<IgniteUuid>,
Iterable<Ignite
     @Override public String toString() {
         return shortString() + '-' + gid.toString();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/01f12a23/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
index 31d0ffa..142b9db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionSelfTest.java
@@ -17,10 +17,18 @@
 
 package org.apache.ignite.internal;
 
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.GridTestTask;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.compute.ComputeJobContext;
 import org.apache.ignite.compute.ComputeTaskFuture;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.resources.JobContextResource;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.testframework.junits.common.GridCommonTest;
 
@@ -68,4 +76,70 @@ public class GridTaskExecutionSelfTest extends GridCommonAbstractTest {
 
         info("Task result: " + fut.get());
     }
-}
\ No newline at end of file
+
+    /**
+     * Test for https://issues.apache.org/jira/browse/IGNITE-1384
+     *
+     * @throws Exception If failed.
+     */
+    public void testJobIdCollision() throws Exception {
+        long locId = IgniteUuid.lastLocalId();
+
+        ArrayList<IgniteFuture<Object>> futs = new ArrayList<>(2016);
+
+        IgniteCompute compute = grid(1).compute(grid(1).cluster().forNodeId(grid(3).localNode().id())).withAsync();
+
+        for (int i = 0; i < 1000; i++) {
+            compute.call(new IgniteCallable<Object>() {
+                @JobContextResource
+                ComputeJobContext ctx;
+
+                boolean held;
+
+                @Override public Object call() throws Exception {
+                    if (!held) {
+                        ctx.holdcc(1000);
+
+                        held = true;
+                    }
+
+                    return null;
+                }
+            });
+
+            futs.add(compute.future());
+        }
+
+        info("Finished first loop.");
+
+        AtomicLong idx = U.field(IgniteUuid.class, "cntGen");
+
+        idx.set(locId);
+
+        IgniteCompute compute1 = grid(2).compute(grid(2).cluster().forNodeId(grid(3).localNode().id())).withAsync();
+
+        for (int i = 0; i < 100; i++) {
+            compute1.call(new IgniteCallable<Object>() {
+                @JobContextResource
+                ComputeJobContext ctx;
+
+                boolean held;
+
+                @Override public Object call() throws Exception {
+                    if (!held) {
+                        ctx.holdcc(1000);
+
+                        held = true;
+                    }
+
+                    return null;
+                }
+            });
+
+            futs.add(compute1.future());
+        }
+
+        for (IgniteFuture<Object> fut : futs)
+            fut.get();
+    }
+}


Mime
View raw message