I understand when we say noOfOwners=2, Infinispan creates a copy for HA. However I am not sure if there is some primary, backup archietecture in place. i.e writes will happen on the primary and backup is just an in-memory copy. When we do getKeySet on a cache we get all the sets of ley locally owned but this creates redundency as well i.e. if there are 2 owners both will return the key.
However when map reduce job is executed by giving a target key it maps to a single node. The question I want to ask: it it possible to get the key (if noOfOwners=2) only on the node where the map reduce job for that key was executed and not on the other owner?
To be clearer, I am doing the following:
1. Execute a map reduce task on a node which is the owner of the key. (The task is routed to a node)
2. Some data operations on this node. Indexes (ram based) created as well.
3. After a timeout an async thread picks the data in the cache and performs some operations. (uses indexed queries)
Now I want step 3 to be only on the node where the map reduce job was executed. I all keySet() on the cache. We can also use custom code , if required, after fetching the keys to find out if they are on the 'primary' node.
You can get hold of DistributionManager via cache.getAdvancedCache() interface and you can then call getPrimaryLocation(Object key), which will return the address of the primary owner.