Search in sources :

Example 56 with RendezvousAffinityFunction

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

the class GridCacheDhtPreloadPutGetSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    assert preloadMode != null;
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setBackups(backups);
    cacheCfg.setAffinity(new RendezvousAffinityFunction());
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    cfg.setCacheConfiguration(cacheCfg);
    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 57 with RendezvousAffinityFunction

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

the class GridCacheDhtPreloadSelfTest method cacheConfiguration.

/**
 * Gets cache configuration for grid with given name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setRebalanceBatchSize(preloadBatchSize);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cacheCfg.setBackups(backups);
    cacheCfg.setOnheapCacheEnabled(onheapCacheEnabled());
    return cacheCfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 58 with RendezvousAffinityFunction

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

the class GridCacheDhtPreloadUnloadSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setRebalanceBatchSize(preloadBatchSize);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(preloadMode);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);
    cc.setAtomicityMode(TRANSACTIONAL);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    if (lbean != null)
        c.setLifecycleBeans(lbean);
    c.setDiscoverySpi(disco);
    c.setCacheConfiguration(cc);
    c.setDeploymentMode(CONTINUOUS);
    c.setNetworkTimeout(netTimeout);
    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 59 with RendezvousAffinityFunction

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

the class GridCacheDhtPreloadMessageCountTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    assert preloadMode != null;
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(preloadMode);
    cc.setAffinity(new RendezvousAffinityFunction(false, 521));
    cc.setBackups(1);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setFailureDetectionTimeout(Integer.MAX_VALUE);
    c.setDiscoverySpi(disco);
    c.setCacheConfiguration(cc);
    TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
    commSpi.record(GridDhtPartitionsSingleMessage.class);
    c.setCommunicationSpi(commSpi);
    return c;
}
Also used : TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) 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 60 with RendezvousAffinityFunction

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

the class IgnitePdsCacheRebalancingAbstractTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    cfg.setConsistentId(gridName);
    CacheConfiguration ccfg1 = cacheConfiguration(cacheName).setPartitionLossPolicy(PartitionLossPolicy.READ_WRITE_SAFE).setBackups(2).setRebalanceMode(CacheRebalanceMode.ASYNC).setIndexedTypes(Integer.class, Integer.class).setAffinity(new RendezvousAffinityFunction(false, 32)).setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    CacheConfiguration ccfg2 = cacheConfiguration("indexed");
    ccfg2.setBackups(1);
    ccfg2.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    QueryEntity qryEntity = new QueryEntity(Integer.class.getName(), TestValue.class.getName());
    LinkedHashMap<String, String> fields = new LinkedHashMap<>();
    fields.put("v1", Integer.class.getName());
    fields.put("v2", Integer.class.getName());
    qryEntity.setFields(fields);
    QueryIndex qryIdx = new QueryIndex("v1", true);
    qryEntity.setIndexes(Collections.singleton(qryIdx));
    ccfg2.setQueryEntities(Collections.singleton(qryEntity));
    // Do not start filtered cache on coordinator.
    if (gridName.endsWith("0")) {
        cfg.setCacheConfiguration(ccfg1, ccfg2);
    } else {
        CacheConfiguration ccfg3 = cacheConfiguration("filtered");
        ccfg3.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
        ccfg3.setBackups(1);
        ccfg3.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
        ccfg3.setNodeFilter(new CoordinatorNodeFilter());
        cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
    }
    DataStorageConfiguration memCfg = new DataStorageConfiguration();
    memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
    memCfg.setPageSize(1024);
    memCfg.setWalMode(WALMode.LOG_ONLY);
    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setMaxSize(150 * 1024 * 1024);
    memPlcCfg.setInitialSize(100 * 1024 * 1024);
    memPlcCfg.setSwapPath("work/swap");
    memPlcCfg.setPersistenceEnabled(true);
    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    cfg.setDataStorageConfiguration(memCfg);
    cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
    return cfg;
}
Also used : QueryEntity(org.apache.ignite.cache.QueryEntity) LinkedHashMap(java.util.LinkedHashMap) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) QueryIndex(org.apache.ignite.cache.QueryIndex) 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