Search in sources :

Example 41 with IgfsGroupDataBlocksKeyMapper

use of org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper in project ignite by apache.

the class IgfsProcessorValidationSelfTest method dataCache.

/**
 * @param grpSize Group size to use in {@link org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper}.
 * @return 2 preconfigured data cache.
 */
private CacheConfiguration dataCache(int grpSize) {
    CacheConfiguration dataCache = defaultCacheConfiguration();
    dataCache.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(grpSize));
    dataCache.setAtomicityMode(TRANSACTIONAL);
    return dataCache;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 42 with IgfsGroupDataBlocksKeyMapper

use of org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper in project ignite by apache.

the class IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest method gridConfigurationManyIgfsCaches.

/**
 * Creates base grid configuration.
 *
 * @param cacheCtn Caches count.
 *
 * @return Base grid configuration.
 * @throws Exception In case of any error.
 */
IgniteConfiguration gridConfigurationManyIgfsCaches(int cacheCtn) throws Exception {
    IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName());
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    List<CacheConfiguration> cachesCfg = new ArrayList<>();
    for (int i = 0; i < cacheCtn; ++i) {
        CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
        dataCacheCfg.setName("partitioned" + i);
        dataCacheCfg.setCacheMode(CacheMode.PARTITIONED);
        dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
        dataCacheCfg.setBackups(0);
        dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
        CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
        metaCacheCfg.setName("replicated" + i);
        metaCacheCfg.setCacheMode(CacheMode.REPLICATED);
        metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
        cachesCfg.add(dataCacheCfg);
        cachesCfg.add(metaCacheCfg);
    }
    cfg.setCacheConfiguration(cachesCfg.toArray(new CacheConfiguration[cachesCfg.size()]));
    return cfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ArrayList(java.util.ArrayList) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) IpcServerTcpEndpoint(org.apache.ignite.internal.util.ipc.loopback.IpcServerTcpEndpoint) IpcSharedMemoryServerEndpoint(org.apache.ignite.internal.util.ipc.shmem.IpcSharedMemoryServerEndpoint) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 43 with IgfsGroupDataBlocksKeyMapper

use of org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper 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)

Example 44 with IgfsGroupDataBlocksKeyMapper

use of org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper 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)

Aggregations

IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)44 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)41 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)25 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)24 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)21 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)12 HashMap (java.util.HashMap)6 IgfsIpcEndpointConfiguration (org.apache.ignite.igfs.IgfsIpcEndpointConfiguration)6 Ignite (org.apache.ignite.Ignite)5 ArrayList (java.util.ArrayList)4 IgfsMode (org.apache.ignite.igfs.IgfsMode)4 AffinityKeyMapper (org.apache.ignite.cache.affinity.AffinityKeyMapper)3 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)3 IgniteUuid (org.apache.ignite.lang.IgniteUuid)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgfsPerBlockLruEvictionPolicy (org.apache.ignite.cache.eviction.igfs.IgfsPerBlockLruEvictionPolicy)1 HadoopConfiguration (org.apache.ignite.configuration.HadoopConfiguration)1