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;
}
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;
}
}
}
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;
}
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;
}
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);
}
Aggregations