use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class CacheDataRegionConfigurationTest method testProperlySizedMemoryPolicy.
/**
* Verifies that with enough memory allocated adding values to cache doesn't cause any exceptions.
*/
public void testProperlySizedMemoryPolicy() throws Exception {
memCfg = new DataStorageConfiguration();
DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
dfltPlcCfg.setName("dfltPlc");
dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
bigPlcCfg.setName("bigPlc");
bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
memCfg.setDataRegionConfigurations(bigPlcCfg);
memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setDataRegionName("bigPlc");
IgniteEx ignite0 = startGrid(0);
IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
try {
for (int i = 0; i < 500_000; i++) cache.put(i, "abc");
} catch (Exception e) {
fail("With properly sized DataRegion no exceptions are expected to be thrown.");
}
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class CacheMetricsEnableRuntimeTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
CacheConfiguration cacheCfg = new CacheConfiguration().setName(CACHE1).setGroupName(GROUP).setCacheMode(CacheMode.PARTITIONED).setAtomicityMode(CacheAtomicityMode.ATOMIC);
cfg.setCacheConfiguration(cacheCfg);
if (persistence)
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY));
return cfg;
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class GridDataStorageConfigurationConsistencySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
DataStorageConfiguration memCfg = new DataStorageConfiguration();
// Nodes will have different page size.
memCfg.setPageSize(DataStorageConfiguration.DFLT_PAGE_SIZE * (1 + getTestIgniteInstanceIndex(gridName)));
cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class DataStorageConfigurationValidationTest method testWalSegmentSizeOveflow.
/**
* Tests {@link DataStorageConfiguration#walSegmentSize} property assertion.
*
* @throws Exception If failed.
*/
public void testWalSegmentSizeOveflow() throws Exception {
final DataStorageConfiguration cfg = new DataStorageConfiguration();
GridTestUtils.assertThrows(null, new Callable<Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void call() {
cfg.setWalSegmentSize(1 << 31);
return null;
}
}, IllegalArgumentException.class, null);
}
use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.
the class CacheLateAffinityAssignmentTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TestRecordingCommunicationSpi commSpi;
if (spiC != null)
commSpi = spiC.apply(igniteInstanceName);
else
commSpi = new TestRecordingCommunicationSpi();
commSpi.setSharedMemoryPort(-1);
cfg.setCommunicationSpi(commSpi);
TestTcpDiscoverySpi discoSpi = new TestTcpDiscoverySpi();
discoSpi.setForceServerMode(forceSrvMode);
discoSpi.setIpFinder(ipFinder);
discoSpi.setNetworkTimeout(60_000);
cfg.setDiscoverySpi(discoSpi);
cfg.setClientFailureDetectionTimeout(100000);
CacheConfiguration[] ccfg;
if (cacheC != null)
ccfg = cacheC.apply(igniteInstanceName);
else
ccfg = new CacheConfiguration[] { cacheConfiguration() };
if (ccfg != null)
cfg.setCacheConfiguration(ccfg);
if (clientC != null) {
client = clientC.apply(igniteInstanceName);
discoSpi.setJoinTimeout(30_000);
}
DataStorageConfiguration cfg1 = new DataStorageConfiguration();
cfg1.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(150 * 1024 * 1024L));
cfg.setDataStorageConfiguration(cfg1);
cfg.setClientMode(client);
return cfg;
}
Aggregations