/** * @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; }
/** * @return IGFS data cache configuration. */ protected CacheConfiguration dataCacheConfiguration() { CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(TRANSACTIONAL); cfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(igfsBlockGroupSize)); cfg.setWriteSynchronizationMode(FULL_SYNC); return cfg; }
/** {@inheritDoc} */ protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setBackups(0); cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }
/** {@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(DATA_BLOCK_GROUP_CNT)); } cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }
/** {@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; }
/** {@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; }
/** {@inheritDoc} */ protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); if (META_CACHE_NAME.equals(cacheName)) cacheCfg.setCacheMode(REPLICATED); else { cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setNearConfiguration(null); cacheCfg.setBackups(0); cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); } cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }
/** {@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(CFG_GRP_SIZE)); } cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC); return cacheCfg; }
/** * Check distribution for integer overflow. * * @throws Exception If failed. */ public void checkIntOverflowDistribution(int partCnt) throws Exception { IgniteUuid fileId = IgniteUuid.randomUuid(); IgfsGroupDataBlocksKeyMapper mapper = new IgfsGroupDataBlocksKeyMapper(1); int part1 = partition(mapper, fileId, Integer.MAX_VALUE - 1, partCnt); int part2 = partition(mapper, fileId, Integer.MAX_VALUE, partCnt); int part3 = partition(mapper, fileId, (long)Integer.MAX_VALUE + 1, partCnt); assert checkPartition(part1, part2, partCnt) : "[fileId = " + fileId + "part1=" + part1 + ", part2=" + part2 + ", partCnt=" + partCnt + ']'; assert checkPartition(part2, part3, partCnt) : "[fileId = " + fileId + "part1=" + part2 + ", part3=" + part3 + ", partCnt=" + partCnt + ']'; }
/** * Gets data cache configuration. * * @return Data cache configuration. */ protected CacheConfiguration dataConfiguration() { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setCacheMode(PARTITIONED); cfg.setBackups(0); cfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(IGFS_GROUP_SIZE)); cfg.setNearConfiguration(null); cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cfg.setAtomicityMode(TRANSACTIONAL); return cfg; }
/** * Gets cache configuration. * * @param igniteInstanceName Ignite instance name. * @return Cache configuration. */ protected CacheConfiguration dataCacheConfiguration(String igniteInstanceName) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setNearConfiguration(null); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE)); cacheCfg.setBackups(0); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }
/** * Gets cache configuration. * * @param igniteInstanceName Ignite instance name. * @return Cache configuration. */ protected CacheConfiguration cacheConfiguration(String igniteInstanceName, String cacheName) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE)); cacheCfg.setBackups(0); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }
/** * @return Data cache configuration. */ protected 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; }
/** * Gets cache configuration. * * @param igniteInstanceName Ignite instance name. * @return Cache configuration. */ protected CacheConfiguration dataCacheConfiguration(String igniteInstanceName) { 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; }
/** * 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; }
/** * 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; }
/** * Creates base grid configuration. * * @return Base grid configuration. * @throws Exception In case of any error. */ protected IgniteConfiguration gridConfiguration() throws Exception { IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName()); CacheConfiguration cc = defaultCacheConfiguration(); cc.setName("partitioned"); cc.setCacheMode(CacheMode.PARTITIONED); cc.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); cc.setBackups(0); cc.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCfg = defaultCacheConfiguration(); metaCfg.setName("replicated"); metaCfg.setCacheMode(CacheMode.REPLICATED); metaCfg.setAtomicityMode(TRANSACTIONAL); cfg.setCacheConfiguration(metaCfg, cc); return cfg; }
/** * @return IGFS configuration for this test. */ protected FileSystemConfiguration getIgfsConfiguration() throws IgniteCheckedException { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName("igfs"); igfsCfg.setBlockSize(512 * 1024); // Together with group blocks mapper will yield 64M per node groups. CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC); dataCacheCfg.setEvictionPolicy(null); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC); metaCacheCfg.setEvictionPolicy(null); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); igfsCfg.setDataCacheConfiguration(dataCacheCfg); return igfsCfg; }
/** * Create grid configuration. * * @param idx Node index. * @return Grid configuration */ private IgniteConfiguration config(int idx) { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName("igfs"); igfsCfg.setBlockSize(BLOCK_SIZE); 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)); dataCacheCfg.setBackups(0); CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); igfsCfg.setDataCacheConfiguration(dataCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setFileSystemConfiguration(igfsCfg); cfg.setIgniteInstanceName("node-" + idx); return cfg; }
/** {@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"); cfg.setFileSystemConfiguration(igfsCfg); Ignite g = G.start(cfg); igfs = g.fileSystem("igfs"); }