Hi, At first. This method (public int partition(final Object key)) returns partition number by key, if you have 1024 partitions it must will be returned number between 0 and 1023. Look at the implementation for RendezvousAffinityFunction[1].
If you want to understand how partitions distributed by nodes, you can use the code snippet: // Getting affinity for person cache. Affinity<Object> affinity = ignite().affinity(cacheName); // Building a list of all partitions numbers. List<Integer> rndParts = new ArrayList<>(10); for (int i = 0; i < affinity.partitions(); i++) rndParts.add(i); // Getting partition to node mapping. Map<Integer, ClusterNode> partPerNodes = affinity.mapPartitionsToNodes(rndParts); Amount of entry on node or on partition you can see in cache.localSizeLong(CachePeekMode.ALL) and cache.localSizeLong(1, CachePeekMode.ALL) respectively. [1] org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction#partition On Tue, Aug 16, 2016 at 7:00 AM, minisoft_rm <[email protected]> wrote: > Hi Experts, i implemented the customised partition thing like below: > [ > public class MattRendezvousAffinityFunction extends > RendezvousAffinityFunction > { > > .......... > public int partition(final Object key){ > ............. > //return 0 or 1 because I launch two nodes > } > > } > ] > > I feel I already touch the most important part.. now I know the default > partitions is 1024. > after launched two ignite server node jvms, I expected to see items goto > each of partitions in nodes.... > > but how to check this thing? (I feel all the items goto the first started > node....) > > the "cache -scan" can not show things within one partition... right? > > > > > -- > View this message in context: http://apache-ignite-users. > 70518.x6.nabble.com/how-to-verify-the-cached-elements-in- > each-of-partitions-tp7085.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. > -- Vladislav Pyatkov
