use of org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction in project ignite by apache.
the class GridCachePartitionedStorePutSelfTest method cacheConfiguration.
/**
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfiguration() {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(PARTITIONED);
cfg.setCacheStoreFactory(singletonFactory(new TestStore()));
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
cfg.setAffinity(new GridCacheModuloAffinityFunction(3, 1));
cfg.setWriteSynchronizationMode(FULL_SYNC);
return cfg;
}
use of org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction in project ignite by apache.
the class GridCacheP2PUndeploySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setNetworkTimeout(2000);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
cfg.setMarshaller(new JdkMarshaller());
CacheConfiguration repCacheCfg = defaultCacheConfiguration();
repCacheCfg.setName("replicated");
repCacheCfg.setCacheMode(REPLICATED);
repCacheCfg.setRebalanceMode(mode);
repCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
repCacheCfg.setAtomicityMode(TRANSACTIONAL);
// TODO GG-10884.
// if (offheap)
// repCacheCfg.setOffHeapMaxMemory(OFFHEAP);
// else
// repCacheCfg.setSwapEnabled(true);
CacheConfiguration partCacheCfg = defaultCacheConfiguration();
partCacheCfg.setName("partitioned");
partCacheCfg.setCacheMode(PARTITIONED);
partCacheCfg.setRebalanceMode(mode);
partCacheCfg.setAffinity(new GridCacheModuloAffinityFunction(11, 1));
partCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
partCacheCfg.setAtomicityMode(TRANSACTIONAL);
// TODO GG-10884.
// if (offheap)
// partCacheCfg.setOffHeapMaxMemory(OFFHEAP);
// else
// partCacheCfg.setSwapEnabled(true);
cfg.setCacheConfiguration(repCacheCfg, partCacheCfg);
cfg.setDeploymentMode(SHARED);
cfg.setPeerClassLoadingLocalClassPathExclude(GridCacheP2PUndeploySelfTest.class.getName());
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, idxGen.getAndIncrement()));
return cfg;
}
use of org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction in project ignite by apache.
the class GridCachePreloadingEvictionsSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
CacheConfiguration partCacheCfg = defaultCacheConfiguration();
partCacheCfg.setCacheMode(PARTITIONED);
partCacheCfg.setAffinity(new GridCacheModuloAffinityFunction(1, 1));
partCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
partCacheCfg.setNearConfiguration(null);
partCacheCfg.setEvictionPolicy(null);
partCacheCfg.setRebalanceMode(ASYNC);
partCacheCfg.setAtomicityMode(TRANSACTIONAL);
// This test requires artificial slowing down of the preloading.
partCacheCfg.setRebalanceThrottle(2000);
cfg.setCacheConfiguration(partCacheCfg);
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, idxGen.getAndIncrement()));
cfg.setNetworkTimeout(60000);
return cfg;
}
Aggregations