You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/06/20 12:52:54 UTC

[14/50] ignite git commit: ignite-3209 Review.

ignite-3209 Review.


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

Branch: refs/heads/ignite-3341
Commit: ebe5658ab22488ea58f46b3fa29705b44c04f451
Parents: e7b85c2
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 15 10:45:35 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 15 10:45:35 2016 +0300

----------------------------------------------------------------------
 .../processors/task/GridTaskWorker.java         |  4 +-
 .../cache/CacheAffinityCallSelfTest.java        | 41 +++++++++++++++-----
 2 files changed, 34 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ebe5658a/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 651259d..0c522ad 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
@@ -1064,9 +1064,9 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
         IgniteInternalFuture<?> affFut = null;
 
         if (affKey != null) {
-            Long topVer = ctx.discovery().topologyVersion();
+            AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
 
-            affFut = ctx.cache().context().exchange().affinityReadyFuture(new AffinityTopologyVersion(topVer));
+            affFut = ctx.cache().context().exchange().affinityReadyFuture(topVer);
         }
 
         if (affFut == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebe5658a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAffinityCallSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAffinityCallSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAffinityCallSelfTest.java
index e4b6ece..8621aa0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAffinityCallSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAffinityCallSelfTest.java
@@ -68,18 +68,20 @@ public class CacheAffinityCallSelfTest extends GridCommonAbstractTest {
         AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
         cfg.setFailoverSpi(failSpi);
 
-        CacheConfiguration ccfg = defaultCacheConfiguration();
-        ccfg.setName(CACHE_NAME);
-        ccfg.setCacheMode(PARTITIONED);
-        ccfg.setBackups(1);
-
-        cfg.setCacheConfiguration(ccfg);
-
+        // Do not configure cache on client.
         if (gridName.equals(getTestGridName(SERVERS_COUNT))) {
             cfg.setClientMode(true);
 
             spi.setForceServerMode(true);
         }
+        else {
+            CacheConfiguration ccfg = defaultCacheConfiguration();
+            ccfg.setName(CACHE_NAME);
+            ccfg.setCacheMode(PARTITIONED);
+            ccfg.setBackups(1);
+
+            cfg.setCacheConfiguration(ccfg);
+        }
 
         return cfg;
     }
@@ -95,7 +97,28 @@ public class CacheAffinityCallSelfTest extends GridCommonAbstractTest {
     public void testAffinityCallRestartNode() throws Exception {
         startGridsMultiThreaded(SERVERS_COUNT);
 
-        final int ITERS = 5;
+        affinityCallRestartNode(grid(1));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAffinityCallFromClientRestartNode() throws Exception {
+        startGridsMultiThreaded(SERVERS_COUNT + 1);
+
+        Ignite client = grid(SERVERS_COUNT);
+
+        assertTrue(client.configuration().isClientMode());
+
+        affinityCallRestartNode(client);
+    }
+
+    /**
+     * @param node Node executing affinity call.
+     * @throws Exception If failed.
+     */
+    private void affinityCallRestartNode(Ignite node) throws Exception {
+        final int ITERS = 10;
 
         for (int i = 0; i < ITERS; i++) {
             log.info("Iteration: " + i);
@@ -115,7 +138,7 @@ public class CacheAffinityCallSelfTest extends GridCommonAbstractTest {
             });
 
             while (!fut.isDone())
-                grid(1).compute().affinityCall(CACHE_NAME, key, new CheckCallable(key, topVer, topVer + 1));
+                node.compute().affinityCall(CACHE_NAME, key, new CheckCallable(key, topVer, topVer + 1));
 
             fut.get();