use of org.apache.ignite.configuration.FileSystemConfiguration in project ignite by apache.
the class IgfsProcessorValidationSelfTest method testRemoteIfPathModeDiffers.
/**
* @throws Exception If failed.
*/
public void testRemoteIfPathModeDiffers() throws Exception {
IgniteConfiguration g2Cfg = getConfiguration("g2");
FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1);
FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2);
g2IgfsCfg1.setPathModes(Collections.singletonMap("/somePath", DUAL_SYNC));
g2IgfsCfg2.setPathModes(Collections.singletonMap("/somePath", DUAL_SYNC));
g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2);
G.start(g1Cfg);
checkGridStartFails(g2Cfg, "Path modes should be the same on all nodes in grid for IGFS", false);
}
use of org.apache.ignite.configuration.FileSystemConfiguration in project ignite by apache.
the class IgfsAbstractRecordResolverSelfTest method beforeTestsStarted.
/** {@inheritDoc} */
@Override
protected void beforeTestsStarted() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setBlockSize(512);
igfsCfg.setDefaultMode(PRIMARY);
CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
dataCacheCfg.setNearConfiguration(new NearCacheConfiguration());
dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
Ignite g = G.start(cfg);
igfs = g.fileSystem("igfs");
}
use of org.apache.ignite.configuration.FileSystemConfiguration 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");
}
use of org.apache.ignite.configuration.FileSystemConfiguration in project ignite by apache.
the class IgfsStartCacheTest method config.
/**
* @param igfs If {@code true} created IGFS configuration.
* @param idx Node index.
* @return Configuration
*/
private IgniteConfiguration config(boolean igfs, int idx) {
IgniteConfiguration cfg = new IgniteConfiguration();
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
if (igfs) {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setDefaultMode(PRIMARY);
igfsCfg.setFragmentizerEnabled(false);
CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(1));
CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
cfg.setFileSystemConfiguration(igfsCfg);
}
cfg.setIgniteInstanceName("node-" + idx);
return cfg;
}
Aggregations