You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by edwardkblk <ed...@blackrock.com> on 2016/09/20 18:28:15 UTC

Race condition with partition affinity mapping

I'm trying to load local partitions of a partitioned cache when a minimum
number of nodes (let's say 2) join a cluster.  To do that I'm deploying a
listener for NODE_JOIN discovery event.  Once the 2nd node joins, the
listener fires on the 1st node and triggers execution of cache load logic in
a separate thread which calls Affinity.primaryPartitions(<local-node>) to
determine specific local partitions to load.  The problem is that this call
returns all partitions which means partition-2-node assignment has not been
updated yet on this 1st node.  However, correct partition set will be
returned if I force a thread to sleep for some time before checking the
partition-2-node assignment.   The same partition determination logic is
executed on the 2nd node as well.  In this case the call to
Affinity.primaryPartitions(<local-node>) always correctly returns every
other partition.  The question is how to avoid the race condition on the 1st
node?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Race-condition-with-partition-affinity-mapping-tp7848.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Race condition with partition affinity mapping

Posted by edwardkblk <ed...@blackrock.com>.
Thank you Vladimir, 
Indeed, I see the expected partition-2-node assignment on the 1st node when
I turned off late-affinity-assignment mode.

However I would see this feature being useful after the initial data set is
loaded into a minimal number of running nodes and while new nodes are
joining the cluster.  Any way to turn it back on at run time after affinity
loading the initial data set?  Or should there be a way to await for
specific AffinityTopology version?





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Race-condition-with-partition-affinity-mapping-tp7848p7953.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Race condition with partition affinity mapping

Posted by Vladimir Ozerov <vo...@gridgain.com>.
Hi.

Looks like you observe "late affinity assignment" feature which is aimed to
achieve better overall cluster performance during rebalance. Please see
IgniteConfiguration.isLateAffinityAssignment() method for more information.

Vladimir.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Race-condition-with-partition-affinity-mapping-tp7848p7947.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.