use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.
the class LargeEntryUpdateTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setPublicThreadPoolSize(THREAD_COUNT);
MemoryConfiguration mem = new MemoryConfiguration();
mem.setPageSize(PAGE_SIZE);
cfg.setMemoryConfiguration(mem);
CacheConfiguration[] ccfgs = new CacheConfiguration[CACHE_COUNT];
for (int i = 0; i < CACHE_COUNT; ++i) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(CACHE_PREFIX + i);
ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfgs[i] = ccfg;
}
cfg.setCacheConfiguration(ccfgs);
return cfg;
}
use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.
the class IgniteCacheContinuousQueryBackupQueueTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(ATOMIC);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setBackups(1);
cfg.setCacheConfiguration(ccfg);
cfg.setClientMode(client);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
MemoryConfiguration memCfg = new MemoryConfiguration();
memCfg.setPageSize(16 * 1024);
cfg.setMemoryConfiguration(memCfg);
return cfg;
}
use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.
the class IgfsSizeSelfTest method checkOversize.
/**
* Ensure that an exception is thrown in case of IGFS oversize.
*
* @throws Exception If failed.
*/
private void checkOversize() throws Exception {
final long maxSize = 32 * 1024 * 1024;
memIgfsdDataPlcSetter = new IgniteInClosure<IgniteConfiguration>() {
@Override
public void apply(IgniteConfiguration cfg) {
String memPlcName = "igfsDataMemPlc";
cfg.setMemoryConfiguration(new MemoryConfiguration().setMemoryPolicies(new MemoryPolicyConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
FileSystemConfiguration igfsCfg = cfg.getFileSystemConfiguration()[0];
igfsCfg.getDataCacheConfiguration().setMemoryPolicyName(memPlcName);
cfg.setCacheConfiguration(new CacheConfiguration().setName("QQQ").setMemoryPolicyName(memPlcName));
}
};
startUp();
final IgfsPath path = new IgfsPath("/file");
final int writeChunkSize = (int) (maxSize / 1024);
// This write is expected to be successful.
IgfsOutputStream os = igfs(0).create(path, false);
os.write(chunk(writeChunkSize));
os.close();
// This write must be successful as well.
os = igfs(0).append(path, false);
os.write(chunk(1));
os.close();
// This write must fail w/ exception.
GridTestUtils.assertThrows(log(), new Callable<Object>() {
@Override
public Object call() throws Exception {
IgfsOutputStream osErr = igfs(0).append(path, false);
try {
for (int i = 0; i < maxSize / writeChunkSize * GRID_CNT; ++i) osErr.write(chunk(writeChunkSize));
osErr.close();
return null;
} catch (IOException e) {
Throwable e0 = e;
while (e0.getCause() != null) e0 = e0.getCause();
throw (Exception) e0;
} finally {
U.closeQuiet(osErr);
}
}
}, IgniteOutOfMemoryException.class, "Not enough memory allocated");
}
Aggregations