Search in sources :

Example 11 with IgfsGroupDataBlocksKeyMapper

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

the class IgfsCacheSelfTest method cacheConfiguration.

/**
 * {@inheritDoc}
 */
protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setName(cacheName);
    if ("meta".equals(cacheName))
        cacheCfg.setCacheMode(REPLICATED);
    else {
        cacheCfg.setCacheMode(PARTITIONED);
        cacheCfg.setNearConfiguration(null);
        cacheCfg.setBackups(0);
        cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    }
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    return cacheCfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 12 with IgfsGroupDataBlocksKeyMapper

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

the class IgfsGroupDataBlockKeyMapperHashSelfTest method checkDistribution.

/**
 * Check hash code generation for the given group size and partitions count.
 *
 * @throws Exception If failed.
 */
public void checkDistribution(int grpSize, int partCnt) throws Exception {
    IgniteUuid fileId = IgniteUuid.randomUuid();
    IgfsGroupDataBlocksKeyMapper mapper = new IgfsGroupDataBlocksKeyMapper(grpSize);
    int lastPart = 0;
    boolean first = true;
    for (int i = 0; i < 10; i++) {
        // Ensure that all blocks within the group has the same hash codes.
        boolean firstInGroup = true;
        for (int j = 0; j < grpSize; j++) {
            int part = partition(mapper, fileId, i * grpSize + j, partCnt);
            if (firstInGroup) {
                if (first)
                    first = false;
                else
                    assert checkPartition(lastPart, part, partCnt) : "[fileId = " + fileId + ", i=" + i + ", j=" + j + ", grpSize= " + grpSize + ", partCnt=" + partCnt + ", lastPart=" + lastPart + ", part=" + part + ']';
                firstInGroup = false;
            } else
                assert part == lastPart;
            lastPart = part;
        }
    }
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteUuid(org.apache.ignite.lang.IgniteUuid)

Example 13 with IgfsGroupDataBlocksKeyMapper

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

the class IgniteHadoopFileSystemClientSelfTest method dataCacheConfiguration.

/**
 * Gets cache configuration.
 *
 * @return Cache configuration.
 */
protected CacheConfiguration dataCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setName("partitioned");
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setNearConfiguration(null);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setEvictionPolicy(null);
    ccfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    ccfg.setBackups(0);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    return ccfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 14 with IgfsGroupDataBlocksKeyMapper

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

the class IgniteHadoopFileSystemIpcCacheSelfTest method dataCacheConfiguration.

/**
 * Gets cache configuration.
 *
 * @return Cache configuration.
 */
private CacheConfiguration dataCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setName("partitioned");
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setNearConfiguration(null);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE));
    ccfg.setBackups(0);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    return ccfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 15 with IgfsGroupDataBlocksKeyMapper

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

the class HadoopSecondaryFileSystemConfigurationTest method startSecondary.

/**
 * Starts secondary IGFS
 */
private void startSecondary() {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
    igfsCfg.setName("igfs_secondary");
    igfsCfg.setIpcEndpointConfiguration(SECONDARY_ENDPOINT_CFG);
    igfsCfg.setBlockSize(512 * 1024);
    igfsCfg.setPrefetchBlocks(1);
    CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setNearConfiguration(null);
    dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE));
    dataCacheCfg.setBackups(0);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
    CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
    igfsCfg.setDataCacheConfiguration(dataCacheCfg);
    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setIgniteInstanceName("grid_secondary");
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);
    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    cfg.setCommunicationSpi(communicationSpi());
    G.start(cfg);
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) 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