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

ignite git commit: IGNITE-3232 - Fixed the number of iterations to find an affinity key.

Repository: ignite
Updated Branches:
  refs/heads/ignite-3232 1e185f1cd -> 5dd968b23


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/5dd968b2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5dd968b2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5dd968b2

Branch: refs/heads/ignite-3232
Commit: 5dd968b2322ae23509abd60c75196badb5c3cd8e
Parents: 1e185f1
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Jun 2 12:52:39 2016 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Jun 2 12:52:39 2016 -0700

----------------------------------------------------------------------
 .../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/5dd968b2/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())
     }
 }