Search in sources :

Example 51 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class CacheStoreReadFromBackupTest method cacheConfig.

/**
 */
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfig(String cacheName) {
    CacheConfiguration ccfg = new CacheConfiguration<>(cacheName);
    ccfg.setCacheMode(cacheMode);
    ccfg.setBackups(backups);
    ccfg.setAtomicityMode(atomicityMode());
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 1));
    ccfg.setReadThrough(true);
    ccfg.setReadFromBackup(true);
    ccfg.setCacheStoreFactory(FactoryBuilder.factoryOf(TestStore.class));
    if (near)
        ccfg.setNearConfiguration(new NearCacheConfiguration());
    return ccfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 52 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class GridCachePartitionedOptimisticTxNodeRestartTest method cacheConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setName(CACHE_NAME);
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(rebalancMode);
    cc.setRebalanceBatchSize(rebalancBatchSize);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);
    cc.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null);
    return cc;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 53 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class GridCachePartitionedTxSalvageSelfTest method getConfiguration.

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

Example 54 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class GridCacheRendezvousAffinityClientSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setForceServerMode(true);
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setBackups(1);
    ccfg.setAffinity(new RendezvousAffinityFunction());
    if (client)
        cfg.setClientMode(true);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 55 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class GridCacheDhtPreloadMultiThreadedSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = loadConfiguration("modules/core/src/test/config/spring-multicache.xml");
    cfg.setIgniteInstanceName(igniteInstanceName);
    for (CacheConfiguration cCfg : cfg.getCacheConfiguration()) {
        if (cCfg.getCacheMode() == CacheMode.PARTITIONED) {
            cCfg.setAffinity(new RendezvousAffinityFunction(2048, null));
            cCfg.setBackups(1);
        }
    }
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)142 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)126 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)71 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)48 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)33 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)33 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)11 Ignite (org.apache.ignite.Ignite)11 IgniteEx (org.apache.ignite.internal.IgniteEx)11 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)10 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)10 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)8 AffinityFunction (org.apache.ignite.cache.affinity.AffinityFunction)8 ArrayList (java.util.ArrayList)7 Random (java.util.Random)7 IgniteCache (org.apache.ignite.IgniteCache)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 QueryEntity (org.apache.ignite.cache.QueryEntity)4 Transaction (org.apache.ignite.transactions.Transaction)4 GridCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager)3