ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkulichenko <valentin.kuliche...@gmail.com>
Subject Re: How does AffinityKey mapped?
Date Wed, 13 Jul 2016 23:53:01 GMT
Hi,

You actually collocate keys, not caches. Let me explain in more detail.

The primary node for a key is defined in two steps:
1. Map cache key to affinity key. This is defined by @AffinityKeyMapped
annotation of AffinityKeyMapper. If none of them is provided, the affinity
key is the same as cache key.
2. Map affinity key to node.

This means that all cache keys that map to the same affinity key will be
mapped to the same node, and this doesn't depend on the cache where these
keys are saved (unless you explicitly provide different affinity
configuration for them, of course).

In your example, affinity key for Employee is organizationId. So all
employees with the same organizationId will go to the same node. The
organization that uses this ID as the cache key will also go to this node.
If there is any other object (e.g. Company) that is stored in different
cache, but identified by the same key, they will also happen to end up on
the same node, but if Employee and Company are  logically not related to
each other, this is just a coincidence.

Let me know if this makes sense to you.

-Val





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-does-AffinityKey-mapped-tp6260p6285.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message