Search in sources :

Example 31 with AffinityFunction

use of org.apache.ignite.cache.affinity.AffinityFunction in project ignite by apache.

the class GridCachePartitionedAffinityExcludeNeighborsPerformanceTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(ipFinder);
    c.setDiscoverySpi(spi);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setBackups(2);
    AffinityFunction aff = new RendezvousAffinityFunction(excNeighbores);
    cc.setAffinity(aff);
    cc.setRebalanceMode(NONE);
    c.setCacheConfiguration(cc);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) AffinityFunction(org.apache.ignite.cache.affinity.AffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 32 with AffinityFunction

use of org.apache.ignite.cache.affinity.AffinityFunction in project ignite by apache.

the class IgnitePdsSingleNodeWithIndexingAndGroupPutGetPersistenceSelfTest method configure.

/**
 * {@inheritDoc}
 */
@Override
protected void configure(IgniteConfiguration cfg) {
    super.configure(cfg);
    for (CacheConfiguration ccfg : cfg.getCacheConfiguration()) {
        AffinityFunction aff = ccfg.getAffinity();
        int parts = aff != null ? aff.partitions() : RendezvousAffinityFunction.DFLT_PARTITION_COUNT;
        ccfg.setGroupName("testGroup-parts" + parts);
    }
}
Also used : AffinityFunction(org.apache.ignite.cache.affinity.AffinityFunction) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

AffinityFunction (org.apache.ignite.cache.affinity.AffinityFunction)32 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)12 ArrayList (java.util.ArrayList)11 List (java.util.List)10 ClusterNode (org.apache.ignite.cluster.ClusterNode)10 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)10 AffinityFunctionContext (org.apache.ignite.cache.affinity.AffinityFunctionContext)8 GridAffinityFunctionContextImpl (org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl)8 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)7 Map (java.util.Map)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 Ignite (org.apache.ignite.Ignite)5 LinkedList (java.util.LinkedList)4 Random (java.util.Random)4 UUID (java.util.UUID)3 IgniteEx (org.apache.ignite.internal.IgniteEx)3 IgniteKernal (org.apache.ignite.internal.IgniteKernal)3 HashSet (java.util.HashSet)2 IgniteAtomicLong (org.apache.ignite.IgniteAtomicLong)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2