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 2016/06/10 06:10:26 UTC

[04/24] ignite git commit: IGNITE-3232 - Fixed the number of iterations to find an affinity key.

IGNITE-3232 - Fixed the number of iterations to find an affinity key.


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

Branch: refs/heads/ignite-3038
Commit: c10097e0a89ae2c3e0c29283243e96d19281ee3b
Parents: 0e4ef3b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Jun 2 22:52:39 2016 +0300
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Jun 3 19:47:13 2016 +0300

----------------------------------------------------------------------
 .../spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c10097e0/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala
index 036dfe6..9ef9846 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteRDD.scala
@@ -334,7 +334,8 @@ class IgniteRDD[K, V] (
     private def affinityKeyFunc(value: V, node: ClusterNode): IgniteUuid = {
         val aff = ic.ignite().affinity[IgniteUuid](cacheName)
 
-        Stream.from(1, 1000).map(_ \u21d2 IgniteUuid.randomUuid()).find(node == null || aff.mapKeyToNode(_).eq(node))
+        Stream.from(1, Math.max(1000, aff.partitions() * 2))
+            .map(_ \u21d2 IgniteUuid.randomUuid()).find(node == null || aff.mapKeyToNode(_).eq(node))
             .getOrElse(IgniteUuid.randomUuid())
     }
 }