Search in sources :

Example 56 with FileSystemConfiguration

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);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration)

Example 57 with FileSystemConfiguration

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");
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Ignite(org.apache.ignite.Ignite) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 58 with FileSystemConfiguration

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");
}
Also used : MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) IOException(java.io.IOException) IgfsOutputStream(org.apache.ignite.igfs.IgfsOutputStream) IOException(java.io.IOException) IgniteOutOfMemoryException(org.apache.ignite.internal.mem.IgniteOutOfMemoryException) IgfsPath(org.apache.ignite.igfs.IgfsPath) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 59 with FileSystemConfiguration

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;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)59 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)40 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)31 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)30 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)24 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)16 IgfsIpcEndpointConfiguration (org.apache.ignite.igfs.IgfsIpcEndpointConfiguration)12 Ignite (org.apache.ignite.Ignite)6 HashMap (java.util.HashMap)5 IgniteHadoopIgfsSecondaryFileSystem (org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem)4 IgfsMode (org.apache.ignite.igfs.IgfsMode)4 ArrayList (java.util.ArrayList)3 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)3 IgniteEx (org.apache.ignite.internal.IgniteEx)2 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteFileSystem (org.apache.ignite.IgniteFileSystem)1