You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Ramzinator <ra...@gmail.com> on 2017/04/13 14:08:09 UTC

Cluster Groups with Affinity Behaviour

Hi all,

I have a question regarding the behavior of affinity calls with cluster
groups.
Consider the following test:

Test.java
<http://apache-ignite-users.70518.x6.nabble.com/file/n11952/Test.java>  

In the test I have 2 ignite nodes: N1 & N2 belonging to the same topology.
Each with a user attribute: 
N1: ROLE --> role1
N2: ROLE --> role2

When I do:

ClusterGroup clusterGroup = node1.cluster().forAttribute(ROLE, "role2");
node2.compute(clusterGroup).affinityCall(CACHE_NAME, "some key", callable);

I would expect the computation to take place on node2 ONLY since it's the
only node in the Cluster.
However, it seems that the affinity of the cache overrides the clusterGroup
and it proceeds to execute on node 1 regardless of the API of
compute(clusterGroup) which states: 

"All operations on the returned IgniteCompute instance will only include
nodes from this cluster group."

Would appreciate your input on this, and also if anyone has an idea on how I
can do an affinityCall on a specific sub-cluster, it would be a great help.

Another question: Is it possible to specify what nodes a cache can use. So
that I can be sure when doing an affinityCall on the cache, I am sure of the
nodes involves in executing the callable?

Thanks a lot,
Ramzinator





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cluster-Groups-with-Affinity-Behaviour-tp11952.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cluster Groups with Affinity Behaviour

Posted by Ramzinator <ra...@gmail.com>.
It's something very specific to my use-case but thank you for clearing it up. 

I just wanted to make sure that the affinityCall overrides the previous
clustering.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cluster-Groups-with-Affinity-Behaviour-tp11952p11990.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cluster Groups with Affinity Behaviour

Posted by vdpyatkov <vl...@gmail.com>.
Hi,

IgniteCompute#affinityCall is executing in the node where the primary
partition (or primary partition of key) stored.
Look at it javadoc:
/**
 * Executes given job on the node where partition is located (the partition
is primary on the node)
...
In other word only one node in whole cluster at one time can execute
IgniteCompute#affinityCall (only one primary partition could be found in a
cluster for specific key/partition).

Why are you want execute IgniteCompute#affinityCall on specific group?
If you want to execute a job in particular ClusterGroup, you can use
IgniteCompute#call.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cluster-Groups-with-Affinity-Behaviour-tp11952p11976.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.