feel free to look at https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/distribution/PessimisticDistSyncTxCacheStoreSharedTest.java and play with it. You'll find out the entries that were in the first node and its underlying cache store are redistributed after the new node joins the cluster. There should not be duplicated records when numOwners=1. The parameter called fetchPersistentState also plays its role here.
Martin: if the cache stored is shared among all nodes/instances, all nodes load all the entries at startup. I have tested this by starting 3 nodes in (aprox) the same time. No info about the replicated/distribution modes is taken into account in the process of preload entries (CacheLoadManagerImpl.preload()). I am using the 5.1.x version obtained from the branch in git.
this is strange. I modified the test above (https://github.com/mgencur/infinispan/commit/c8025e10982dde257e5919e0aecf58bb24e18959) and when I run it, I get output similar to:
Other times I get this:
It is a distributed mode so the distribution depends on a hash-wheel algorithm. Can you provide a test that proves your theses? e.g. similar to the above one
Martin: there is no need for the test. If you have a shared cache loader with preload=true, CacheLoaderManagerImpl preloads all entries. I think this should be different in case "distribution" mode is selected. Maybe preload entries based on the consistent hash? (only those which are owned by the node)?
For more info, this is the relevant parts of my configuration.
<loaders passivation="false" shared="true" preload="true">
Using Infinispan 5.1.5