http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/GridCacheIgfsPerBlockLruEvictionPolicySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/GridCacheIgfsPerBlockLruEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/GridCacheIgfsPerBlockLruEvictionPolicySelfTest.java deleted file mode 100644 index f0e2c70..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/GridCacheIgfsPerBlockLruEvictionPolicySelfTest.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.igfs; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.eviction.igfs.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.igfs.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.lang.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.testframework.*; - -import java.util.*; -import java.util.concurrent.*; - -import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.igfs.IgfsMode.*; - -/** - * Tests for IGFS per-block LR eviction policy. - */ -@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"}) -public class GridCacheIgfsPerBlockLruEvictionPolicySelfTest extends IgfsCommonAbstractTest { - /** Primary IGFS name. */ - private static final String IGFS_PRIMARY = "igfs-primary"; - - /** Primary IGFS name. */ - private static final String IGFS_SECONDARY = "igfs-secondary"; - - /** Secondary file system REST endpoint configuration map. */ - private static final Map<String, String> SECONDARY_REST_CFG = new HashMap<String, String>() {{ - put("type", "tcp"); - put("port", "11500"); - }}; - - /** File working in PRIMARY mode. */ - public static final IgfsPath FILE = new IgfsPath("/file"); - - /** File working in DUAL mode. */ - public static final IgfsPath FILE_RMT = new IgfsPath("/fileRemote"); - - /** Primary IGFS instances. */ - private static IgfsImpl igfsPrimary; - - /** Secondary IGFS instance. */ - private static IgniteFs secondaryFs; - - /** Primary file system data cache. */ - private static GridCacheAdapter<IgfsBlockKey, byte[]> dataCache; - - /** Eviction policy */ - private static CacheIgfsPerBlockLruEvictionPolicy evictPlc; - - /** - * Start a grid with the primary file system. - * - * @throws Exception If failed. - */ - private void startPrimary() throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); - - igfsCfg.setDataCacheName("dataCache"); - igfsCfg.setMetaCacheName("metaCache"); - igfsCfg.setName(IGFS_PRIMARY); - igfsCfg.setBlockSize(512); - igfsCfg.setDefaultMode(PRIMARY); - igfsCfg.setPrefetchBlocks(1); - igfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE); - igfsCfg.setSecondaryFileSystem(secondaryFs); - - Map<String, IgfsMode> pathModes = new HashMap<>(); - - pathModes.put(FILE_RMT.toString(), DUAL_SYNC); - - igfsCfg.setPathModes(pathModes); - - CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); - - dataCacheCfg.setName("dataCache"); - dataCacheCfg.setCacheMode(PARTITIONED); - dataCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); - dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - dataCacheCfg.setAtomicityMode(TRANSACTIONAL); - - evictPlc = new CacheIgfsPerBlockLruEvictionPolicy(); - - dataCacheCfg.setEvictionPolicy(evictPlc); - dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); - dataCacheCfg.setBackups(0); - dataCacheCfg.setQueryIndexEnabled(false); - - CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); - - metaCacheCfg.setName("metaCache"); - metaCacheCfg.setCacheMode(REPLICATED); - metaCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); - metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - metaCacheCfg.setQueryIndexEnabled(false); - metaCacheCfg.setAtomicityMode(TRANSACTIONAL); - - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setGridName("grid-primary"); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); - - cfg.setDiscoverySpi(discoSpi); - cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); - - cfg.setLocalHost("127.0.0.1"); - cfg.setConnectorConfiguration(null); - - Ignite g = G.start(cfg); - - igfsPrimary = (IgfsImpl)g.fileSystem(IGFS_PRIMARY); - - dataCache = igfsPrimary.context().kernalContext().cache().internalCache( - igfsPrimary.context().configuration().getDataCacheName()); - } - - /** - * Start a grid with the secondary file system. - * - * @throws Exception If failed. - */ - private void startSecondary() throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); - - igfsCfg.setDataCacheName("dataCache"); - igfsCfg.setMetaCacheName("metaCache"); - igfsCfg.setName(IGFS_SECONDARY); - igfsCfg.setBlockSize(512); - igfsCfg.setDefaultMode(PRIMARY); - igfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG); - - CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); - - dataCacheCfg.setName("dataCache"); - dataCacheCfg.setCacheMode(PARTITIONED); - dataCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); - dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); - dataCacheCfg.setBackups(0); - dataCacheCfg.setQueryIndexEnabled(false); - dataCacheCfg.setAtomicityMode(TRANSACTIONAL); - - CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); - - metaCacheCfg.setName("metaCache"); - metaCacheCfg.setCacheMode(REPLICATED); - metaCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); - metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - metaCacheCfg.setQueryIndexEnabled(false); - metaCacheCfg.setAtomicityMode(TRANSACTIONAL); - - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setGridName("grid-secondary"); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); - - cfg.setDiscoverySpi(discoSpi); - cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); - - cfg.setLocalHost("127.0.0.1"); - cfg.setConnectorConfiguration(null); - - Ignite g = G.start(cfg); - - secondaryFs = g.fileSystem(IGFS_SECONDARY); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - try { - // Cleanup. - igfsPrimary.format(); - - while (!dataCache.isEmpty()) - U.sleep(100); - - checkEvictionPolicy(0, 0); - } - finally { - stopAllGrids(false); - } - } - - /** - * Startup primary and secondary file systems. - * - * @throws Exception If failed. - */ - private void start() throws Exception { - startSecondary(); - startPrimary(); - - evictPlc.setMaxBlocks(0); - evictPlc.setMaxSize(0); - evictPlc.setExcludePaths(null); - } - - /** - * Test how evictions are handled for a file working in PRIMARY mode. - * - * @throws Exception If failed. - */ - public void testFilePrimary() throws Exception { - start(); - - // Create file in primary mode. It must not be propagated to eviction policy. - igfsPrimary.create(FILE, true).close(); - - checkEvictionPolicy(0, 0); - - int blockSize = igfsPrimary.info(FILE).blockSize(); - - append(FILE, blockSize); - - checkEvictionPolicy(0, 0); - - read(FILE, 0, blockSize); - - checkEvictionPolicy(0, 0); - } - - /** - * Test how evictions are handled for a file working in PRIMARY mode. - * - * @throws Exception If failed. - */ - public void testFileDual() throws Exception { - start(); - - igfsPrimary.create(FILE_RMT, true).close(); - - checkEvictionPolicy(0, 0); - - int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); - - // File write. - append(FILE_RMT, blockSize); - - checkEvictionPolicy(1, blockSize); - - // One more write. - append(FILE_RMT, blockSize); - - checkEvictionPolicy(2, blockSize * 2); - - // Read. - read(FILE_RMT, 0, blockSize); - - checkEvictionPolicy(2, blockSize * 2); - } - - /** - * Ensure that a DUAL mode file is not propagated to eviction policy - * - * @throws Exception If failed. - */ - public void testFileDualExclusion() throws Exception { - start(); - - evictPlc.setExcludePaths(Collections.singleton(FILE_RMT.toString())); - - // Create file in primary mode. It must not be propagated to eviction policy. - igfsPrimary.create(FILE_RMT, true).close(); - - checkEvictionPolicy(0, 0); - - int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); - - append(FILE_RMT, blockSize); - - checkEvictionPolicy(0, 0); - - read(FILE_RMT, 0, blockSize); - - checkEvictionPolicy(0, 0); - } - - /** - * Ensure that exception is thrown in case we are trying to rename file with one exclude setting to the file with - * another. - * - * @throws Exception If failed. - */ - public void testRenameDifferentExcludeSettings() throws Exception { - start(); - - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override public Object call() throws Exception { - igfsPrimary.rename(FILE, FILE_RMT); - - return null; - } - }, IgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " + - "(need to copy and remove)"); - - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override public Object call() throws Exception { - igfsPrimary.rename(FILE_RMT, FILE); - - return null; - } - }, IgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " + - "(need to copy and remove)"); - } - - /** - * Test eviction caused by too much blocks. - * - * @throws Exception If failed. - */ - public void testBlockCountEviction() throws Exception { - start(); - - int blockCnt = 3; - - evictPlc.setMaxBlocks(blockCnt); - - igfsPrimary.create(FILE_RMT, true).close(); - - checkEvictionPolicy(0, 0); - - int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); - - // Write blocks up to the limit. - append(FILE_RMT, blockSize * blockCnt); - - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Write one more block what should cause eviction. - append(FILE_RMT, blockSize); - - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Read the first block. - read(FILE_RMT, 0, blockSize); - - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - checkMetrics(1, 1); - } - - /** - * Test eviction caused by too big data size. - * - * @throws Exception If failed. - */ - public void testDataSizeEviction() throws Exception { - start(); - - igfsPrimary.create(FILE_RMT, true).close(); - - int blockCnt = 3; - int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); - - evictPlc.setMaxSize(blockSize * blockCnt); - - // Write blocks up to the limit. - append(FILE_RMT, blockSize * blockCnt); - - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Reset metrics. - igfsPrimary.resetMetrics(); - - // Read the first block what should cause reordering. - read(FILE_RMT, 0, blockSize); - - checkMetrics(1, 0); - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Write one more block what should cause eviction of the block 2. - append(FILE_RMT, blockSize); - - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Read the first block. - read(FILE_RMT, 0, blockSize); - - checkMetrics(2, 0); - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - - // Read the second block (which was evicted). - read(FILE_RMT, blockSize, blockSize); - - checkMetrics(3, 1); - checkEvictionPolicy(blockCnt, blockCnt * blockSize); - } - - /** - * Read some data from the given file with the given offset. - * - * @param path File path. - * @param off Offset. - * @param len Length. - * @throws Exception If failed. - */ - private void read(IgfsPath path, int off, int len) throws Exception { - IgfsInputStream is = igfsPrimary.open(path); - - is.readFully(off, new byte[len]); - - is.close(); - } - - /** - * Append some data to the given file. - * - * @param path File path. - * @param len Data length. - * @throws Exception If failed. - */ - private void append(IgfsPath path, int len) throws Exception { - IgfsOutputStream os = igfsPrimary.append(path, false); - - os.write(new byte[len]); - - os.close(); - } - - /** - * Check metrics counters. - * - * @param blocksRead Expected blocks read. - * @param blocksReadRmt Expected blocks read remote. - * @throws Exception If failed. - */ - public void checkMetrics(final long blocksRead, final long blocksReadRmt) throws Exception { - assert GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - IgfsMetrics metrics = igfsPrimary.metrics(); - - return metrics.blocksReadTotal() == blocksRead && metrics.blocksReadRemote() == blocksReadRmt; - } - }, 5000) : "Unexpected metrics [expectedBlocksReadTotal=" + blocksRead + ", actualBlocksReadTotal=" + - igfsPrimary.metrics().blocksReadTotal() + ", expectedBlocksReadRemote=" + blocksReadRmt + - ", actualBlocksReadRemote=" + igfsPrimary.metrics().blocksReadRemote() + ']'; - } - - /** - * Check eviction policy state. - * - * @param curBlocks Current blocks. - * @param curBytes Current bytes. - */ - private void checkEvictionPolicy(final int curBlocks, final long curBytes) throws IgniteInterruptedCheckedException { - assert GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - return evictPlc.getCurrentBlocks() == curBlocks && evictPlc.getCurrentSize() == curBytes; - } - }, 5000) : "Unexpected counts [expectedBlocks=" + curBlocks + ", actualBlocks=" + evictPlc.getCurrentBlocks() + - ", expectedBytes=" + curBytes + ", currentBytes=" + curBytes + ']'; - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java index a7e6780..9a99611 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.igfs.*; +import org.apache.ignite.igfs.secondary.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; @@ -37,11 +38,11 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; -import static org.apache.ignite.IgniteFs.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMemoryMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.igfs.IgfsMode.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; /** * Test fo regular igfs operations. @@ -154,7 +155,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { igfsSecondary = (IgfsImpl) igniteSecondary.fileSystem("igfs-secondary"); - Ignite ignite = startGridWithIgfs("ignite", "igfs", mode, igfsSecondary, PRIMARY_REST_CFG); + Ignite ignite = startGridWithIgfs("ignite", "igfs", mode, igfsSecondary.asSecondary(), PRIMARY_REST_CFG); igfs = (IgfsImpl) ignite.fileSystem("igfs"); } @@ -181,8 +182,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ protected Ignite startGridWithIgfs(String gridName, String igfsName, IgfsMode mode, - @Nullable Igfs secondaryFs, @Nullable Map<String, String> restCfg) throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + @Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable Map<String, String> restCfg) throws Exception { + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); @@ -225,7 +226,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); @@ -262,7 +263,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testExists() throws Exception { - create(igfs, paths(DIR), null); + create(igfs.asSecondary(), paths(DIR), null); checkExist(igfs, igfsSecondary, DIR); } @@ -373,7 +374,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { IgfsPath file1 = new IgfsPath("/file1"); IgfsPath file2 = new IgfsPath("/file2"); - create(igfs, null, paths(file1)); + create(igfs.asSecondary(), null, paths(file1)); igfs.rename(file1, file2); @@ -405,7 +406,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { IgfsPath dir1 = new IgfsPath("/dir1"); IgfsPath dir2 = new IgfsPath("/dir2"); - create(igfs, paths(dir1), null); + create(igfs.asSecondary(), paths(dir1), null); igfs.rename(dir1, dir2); @@ -434,7 +435,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testMoveFileDestinationRoot() throws Exception { - create(igfs, paths(DIR, SUBDIR), paths(FILE)); + create(igfs.asSecondary(), paths(DIR, SUBDIR), paths(FILE)); igfs.rename(FILE, new IgfsPath()); @@ -526,7 +527,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testMoveDirectoryDestinationRoot() throws Exception { - create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), null); + create(igfs.asSecondary(), paths(DIR, SUBDIR, SUBSUBDIR), null); igfs.rename(SUBSUBDIR, new IgfsPath()); @@ -542,7 +543,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testMoveDirectorySourceParentRoot() throws Exception { IgfsPath dir = new IgfsPath("/" + SUBSUBDIR.name()); - create(igfs, paths(DIR_NEW, SUBDIR_NEW, dir), null); + create(igfs.asSecondary(), paths(DIR_NEW, SUBDIR_NEW, dir), null); igfs.rename(dir, SUBDIR_NEW); @@ -851,7 +852,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testOpen() throws Exception { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, true, chunk); + createFile(igfs.asSecondary(), FILE, true, chunk); checkFileContent(igfs, FILE, chunk); } @@ -886,9 +887,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreate() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + create(igfs.asSecondary(), paths(DIR, SUBDIR), null); - createFile(igfs, FILE, true, chunk); + createFile(igfs.asSecondary(), FILE, true, chunk); checkFile(igfs, igfsSecondary, FILE, chunk); } @@ -901,7 +902,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testCreateParentRoot() throws Exception { IgfsPath file = new IgfsPath("/" + FILE.name()); - createFile(igfs, file, true, chunk); + createFile(igfs.asSecondary(), file, true, chunk); checkFile(igfs, igfsSecondary, file, chunk); } @@ -1092,7 +1093,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { assert igfs.exists(path); } - awaitFileClose(igfs, path); + awaitFileClose(igfs.asSecondary(), path); checkFileContent(igfs, path, chunk); } @@ -1166,7 +1167,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { fut.get(); - awaitFileClose(igfs, FILE); + awaitFileClose(igfs.asSecondary(), FILE); if (err.get() != null) throw err.get(); @@ -1212,7 +1213,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testAppendNoClose() throws Exception { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); GridTestUtils.assertThrowsInherited(log(), new Callable<Object>() { @Override public Object call() throws Exception { @@ -1241,7 +1242,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testAppendRenameNoClose() throws Exception { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); IgfsOutputStream os = null; @@ -1263,9 +1264,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendRenameParentNoClose() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + create(igfs.asSecondary(), paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); IgfsOutputStream os = null; @@ -1289,7 +1290,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testAppendDeleteNoClose() throws Exception { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -1321,7 +1322,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { public void testAppendDeleteParentNoClose() throws Exception { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -1360,7 +1361,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { create(igfs, paths(DIR, SUBDIR), null); - createFile(igfs, FILE, false); + createFile(igfs.asSecondary(), FILE, false); IgfsOutputStream os = null; @@ -1388,7 +1389,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { int threadCnt = 10; for (int i = 0; i < threadCnt; i++) - createFile(igfs, new IgfsPath("/file" + i), false); + createFile(igfs.asSecondary(), new IgfsPath("/file" + i), false); multithreaded(new Runnable() { @Override public void run() { @@ -1411,7 +1412,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { assert igfs.exists(path); } - awaitFileClose(igfs, path); + awaitFileClose(igfs.asSecondary(), path); checkFileContent(igfs, path, chunks); } @@ -1483,7 +1484,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { fut.get(); - awaitFileClose(igfs, FILE); + awaitFileClose(igfs.asSecondary(), FILE); if (err.get() != null) throw err.get(); @@ -2137,7 +2138,19 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param files Files. * @throws Exception If failed. */ - public static void create(Igfs igfs, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) + public static void create(IgfsImpl igfs, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception { + create(igfs.asSecondary(), dirs, files); + } + + /** + * Create the given directories and files in the given IGFS. + * + * @param igfs IGFS. + * @param dirs Directories. + * @param files Files. + * @throws Exception If failed. + */ + public static void create(IgfsSecondaryFileSystem igfs, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception { if (dirs != null) { for (IgfsPath dir : dirs) @@ -2162,7 +2175,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param chunks Data chunks. * @throws IOException In case of IO exception. */ - protected static void createFile(Igfs igfs, IgfsPath file, boolean overwrite, @Nullable byte[]... chunks) + protected static void createFile(IgfsSecondaryFileSystem igfs, IgfsPath file, boolean overwrite, @Nullable byte[]... chunks) throws IOException { OutputStream os = null; @@ -2188,7 +2201,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param chunks Data chunks. * @throws Exception If failed. */ - protected void createFile(IgniteFs igfs, IgfsPath file, boolean overwrite, long blockSize, + protected void createFile(IgfsImpl igfs, IgfsPath file, boolean overwrite, long blockSize, @Nullable byte[]... chunks) throws Exception { IgfsOutputStream os = null; @@ -2200,7 +2213,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { finally { U.closeQuiet(os); - awaitFileClose(igfs, file); + awaitFileClose(igfs.asSecondary(), file); } } @@ -2212,7 +2225,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param chunks Data chunks. * @throws Exception If failed. */ - protected void appendFile(IgniteFs igfs, IgfsPath file, @Nullable byte[]... chunks) + protected void appendFile(IgfsImpl igfs, IgfsPath file, @Nullable byte[]... chunks) throws Exception { IgfsOutputStream os = null; @@ -2224,7 +2237,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { finally { U.closeQuiet(os); - awaitFileClose(igfs, file); + awaitFileClose(igfs.asSecondary(), file); } } @@ -2248,7 +2261,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param igfs IGFS. * @param file File. */ - public static void awaitFileClose(Igfs igfs, IgfsPath file) { + public static void awaitFileClose(IgfsSecondaryFileSystem igfs, IgfsPath file) { try { igfs.update(file, Collections.singletonMap("prop", "val")); } @@ -2418,7 +2431,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param igfsSecondary Second IGFS. * @throws Exception If failed. */ - protected void clear(IgniteFs igfs, IgniteFs igfsSecondary) throws Exception { + protected void clear(IgniteFileSystem igfs, IgniteFileSystem igfsSecondary) throws Exception { clear(igfs); if (dual) @@ -2431,7 +2444,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param igfs IGFS. * @throws Exception If failed. */ - public static void clear(IgniteFs igfs) throws Exception { + public static void clear(IgniteFileSystem igfs) throws Exception { Field workerMapFld = IgfsImpl.class.getDeclaredField("workerMap"); workerMapFld.setAccessible(true); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java new file mode 100644 index 0000000..fd590f5 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java @@ -0,0 +1,485 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +import org.apache.ignite.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.cache.eviction.igfs.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.igfs.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.*; + +import java.util.*; +import java.util.concurrent.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; +import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.igfs.IgfsMode.*; + +/** + * Tests for IGFS per-block LR eviction policy. + */ +@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"}) +public class IgfsCachePerBlockLruEvictionPolicySelfTest extends IgfsCommonAbstractTest { + /** Primary IGFS name. */ + private static final String IGFS_PRIMARY = "igfs-primary"; + + /** Primary IGFS name. */ + private static final String IGFS_SECONDARY = "igfs-secondary"; + + /** Secondary file system REST endpoint configuration map. */ + private static final Map<String, String> SECONDARY_REST_CFG = new HashMap<String, String>() {{ + put("type", "tcp"); + put("port", "11500"); + }}; + + /** File working in PRIMARY mode. */ + public static final IgfsPath FILE = new IgfsPath("/file"); + + /** File working in DUAL mode. */ + public static final IgfsPath FILE_RMT = new IgfsPath("/fileRemote"); + + /** Primary IGFS instances. */ + private static IgfsImpl igfsPrimary; + + /** Secondary IGFS instance. */ + private static IgfsImpl secondaryFs; + + /** Primary file system data cache. */ + private static GridCacheAdapter<IgfsBlockKey, byte[]> dataCache; + + /** Eviction policy */ + private static CacheIgfsPerBlockLruEvictionPolicy evictPlc; + + /** + * Start a grid with the primary file system. + * + * @throws Exception If failed. + */ + private void startPrimary() throws Exception { + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); + + igfsCfg.setDataCacheName("dataCache"); + igfsCfg.setMetaCacheName("metaCache"); + igfsCfg.setName(IGFS_PRIMARY); + igfsCfg.setBlockSize(512); + igfsCfg.setDefaultMode(PRIMARY); + igfsCfg.setPrefetchBlocks(1); + igfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE); + igfsCfg.setSecondaryFileSystem(secondaryFs.asSecondary()); + + Map<String, IgfsMode> pathModes = new HashMap<>(); + + pathModes.put(FILE_RMT.toString(), DUAL_SYNC); + + igfsCfg.setPathModes(pathModes); + + CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); + + dataCacheCfg.setName("dataCache"); + dataCacheCfg.setCacheMode(PARTITIONED); + dataCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); + dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + dataCacheCfg.setAtomicityMode(TRANSACTIONAL); + + evictPlc = new CacheIgfsPerBlockLruEvictionPolicy(); + + dataCacheCfg.setEvictionPolicy(evictPlc); + dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); + dataCacheCfg.setBackups(0); + dataCacheCfg.setQueryIndexEnabled(false); + + CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); + + metaCacheCfg.setName("metaCache"); + metaCacheCfg.setCacheMode(REPLICATED); + metaCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); + metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + metaCacheCfg.setQueryIndexEnabled(false); + metaCacheCfg.setAtomicityMode(TRANSACTIONAL); + + IgniteConfiguration cfg = new IgniteConfiguration(); + + cfg.setGridName("grid-primary"); + + TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); + + discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); + + cfg.setDiscoverySpi(discoSpi); + cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); + cfg.setFileSystemConfiguration(igfsCfg); + + cfg.setLocalHost("127.0.0.1"); + cfg.setConnectorConfiguration(null); + + Ignite g = G.start(cfg); + + igfsPrimary = (IgfsImpl)g.fileSystem(IGFS_PRIMARY); + + dataCache = igfsPrimary.context().kernalContext().cache().internalCache( + igfsPrimary.context().configuration().getDataCacheName()); + } + + /** + * Start a grid with the secondary file system. + * + * @throws Exception If failed. + */ + private void startSecondary() throws Exception { + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); + + igfsCfg.setDataCacheName("dataCache"); + igfsCfg.setMetaCacheName("metaCache"); + igfsCfg.setName(IGFS_SECONDARY); + igfsCfg.setBlockSize(512); + igfsCfg.setDefaultMode(PRIMARY); + igfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG); + + CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); + + dataCacheCfg.setName("dataCache"); + dataCacheCfg.setCacheMode(PARTITIONED); + dataCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); + dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); + dataCacheCfg.setBackups(0); + dataCacheCfg.setQueryIndexEnabled(false); + dataCacheCfg.setAtomicityMode(TRANSACTIONAL); + + CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); + + metaCacheCfg.setName("metaCache"); + metaCacheCfg.setCacheMode(REPLICATED); + metaCacheCfg.setDistributionMode(CacheDistributionMode.PARTITIONED_ONLY); + metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + metaCacheCfg.setQueryIndexEnabled(false); + metaCacheCfg.setAtomicityMode(TRANSACTIONAL); + + IgniteConfiguration cfg = new IgniteConfiguration(); + + cfg.setGridName("grid-secondary"); + + TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); + + discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); + + cfg.setDiscoverySpi(discoSpi); + cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); + cfg.setFileSystemConfiguration(igfsCfg); + + cfg.setLocalHost("127.0.0.1"); + cfg.setConnectorConfiguration(null); + + Ignite g = G.start(cfg); + + secondaryFs = (IgfsImpl)g.fileSystem(IGFS_SECONDARY); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + try { + // Cleanup. + igfsPrimary.format(); + + while (!dataCache.isEmpty()) + U.sleep(100); + + checkEvictionPolicy(0, 0); + } + finally { + stopAllGrids(false); + } + } + + /** + * Startup primary and secondary file systems. + * + * @throws Exception If failed. + */ + private void start() throws Exception { + startSecondary(); + startPrimary(); + + evictPlc.setMaxBlocks(0); + evictPlc.setMaxSize(0); + evictPlc.setExcludePaths(null); + } + + /** + * Test how evictions are handled for a file working in PRIMARY mode. + * + * @throws Exception If failed. + */ + public void testFilePrimary() throws Exception { + start(); + + // Create file in primary mode. It must not be propagated to eviction policy. + igfsPrimary.create(FILE, true).close(); + + checkEvictionPolicy(0, 0); + + int blockSize = igfsPrimary.info(FILE).blockSize(); + + append(FILE, blockSize); + + checkEvictionPolicy(0, 0); + + read(FILE, 0, blockSize); + + checkEvictionPolicy(0, 0); + } + + /** + * Test how evictions are handled for a file working in PRIMARY mode. + * + * @throws Exception If failed. + */ + public void testFileDual() throws Exception { + start(); + + igfsPrimary.create(FILE_RMT, true).close(); + + checkEvictionPolicy(0, 0); + + int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); + + // File write. + append(FILE_RMT, blockSize); + + checkEvictionPolicy(1, blockSize); + + // One more write. + append(FILE_RMT, blockSize); + + checkEvictionPolicy(2, blockSize * 2); + + // Read. + read(FILE_RMT, 0, blockSize); + + checkEvictionPolicy(2, blockSize * 2); + } + + /** + * Ensure that a DUAL mode file is not propagated to eviction policy + * + * @throws Exception If failed. + */ + public void testFileDualExclusion() throws Exception { + start(); + + evictPlc.setExcludePaths(Collections.singleton(FILE_RMT.toString())); + + // Create file in primary mode. It must not be propagated to eviction policy. + igfsPrimary.create(FILE_RMT, true).close(); + + checkEvictionPolicy(0, 0); + + int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); + + append(FILE_RMT, blockSize); + + checkEvictionPolicy(0, 0); + + read(FILE_RMT, 0, blockSize); + + checkEvictionPolicy(0, 0); + } + + /** + * Ensure that exception is thrown in case we are trying to rename file with one exclude setting to the file with + * another. + * + * @throws Exception If failed. + */ + public void testRenameDifferentExcludeSettings() throws Exception { + start(); + + GridTestUtils.assertThrows(log, new Callable<Object>() { + @Override public Object call() throws Exception { + igfsPrimary.rename(FILE, FILE_RMT); + + return null; + } + }, IgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " + + "(need to copy and remove)"); + + GridTestUtils.assertThrows(log, new Callable<Object>() { + @Override public Object call() throws Exception { + igfsPrimary.rename(FILE_RMT, FILE); + + return null; + } + }, IgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " + + "(need to copy and remove)"); + } + + /** + * Test eviction caused by too much blocks. + * + * @throws Exception If failed. + */ + public void testBlockCountEviction() throws Exception { + start(); + + int blockCnt = 3; + + evictPlc.setMaxBlocks(blockCnt); + + igfsPrimary.create(FILE_RMT, true).close(); + + checkEvictionPolicy(0, 0); + + int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); + + // Write blocks up to the limit. + append(FILE_RMT, blockSize * blockCnt); + + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Write one more block what should cause eviction. + append(FILE_RMT, blockSize); + + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Read the first block. + read(FILE_RMT, 0, blockSize); + + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + checkMetrics(1, 1); + } + + /** + * Test eviction caused by too big data size. + * + * @throws Exception If failed. + */ + public void testDataSizeEviction() throws Exception { + start(); + + igfsPrimary.create(FILE_RMT, true).close(); + + int blockCnt = 3; + int blockSize = igfsPrimary.info(FILE_RMT).blockSize(); + + evictPlc.setMaxSize(blockSize * blockCnt); + + // Write blocks up to the limit. + append(FILE_RMT, blockSize * blockCnt); + + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Reset metrics. + igfsPrimary.resetMetrics(); + + // Read the first block what should cause reordering. + read(FILE_RMT, 0, blockSize); + + checkMetrics(1, 0); + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Write one more block what should cause eviction of the block 2. + append(FILE_RMT, blockSize); + + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Read the first block. + read(FILE_RMT, 0, blockSize); + + checkMetrics(2, 0); + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + + // Read the second block (which was evicted). + read(FILE_RMT, blockSize, blockSize); + + checkMetrics(3, 1); + checkEvictionPolicy(blockCnt, blockCnt * blockSize); + } + + /** + * Read some data from the given file with the given offset. + * + * @param path File path. + * @param off Offset. + * @param len Length. + * @throws Exception If failed. + */ + private void read(IgfsPath path, int off, int len) throws Exception { + IgfsInputStream is = igfsPrimary.open(path); + + is.readFully(off, new byte[len]); + + is.close(); + } + + /** + * Append some data to the given file. + * + * @param path File path. + * @param len Data length. + * @throws Exception If failed. + */ + private void append(IgfsPath path, int len) throws Exception { + IgfsOutputStream os = igfsPrimary.append(path, false); + + os.write(new byte[len]); + + os.close(); + } + + /** + * Check metrics counters. + * + * @param blocksRead Expected blocks read. + * @param blocksReadRmt Expected blocks read remote. + * @throws Exception If failed. + */ + public void checkMetrics(final long blocksRead, final long blocksReadRmt) throws Exception { + assert GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + IgfsMetrics metrics = igfsPrimary.metrics(); + + return metrics.blocksReadTotal() == blocksRead && metrics.blocksReadRemote() == blocksReadRmt; + } + }, 5000) : "Unexpected metrics [expectedBlocksReadTotal=" + blocksRead + ", actualBlocksReadTotal=" + + igfsPrimary.metrics().blocksReadTotal() + ", expectedBlocksReadRemote=" + blocksReadRmt + + ", actualBlocksReadRemote=" + igfsPrimary.metrics().blocksReadRemote() + ']'; + } + + /** + * Check eviction policy state. + * + * @param curBlocks Current blocks. + * @param curBytes Current bytes. + */ + private void checkEvictionPolicy(final int curBlocks, final long curBytes) throws IgniteInterruptedCheckedException { + assert GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + return evictPlc.getCurrentBlocks() == curBlocks && evictPlc.getCurrentSize() == curBytes; + } + }, 5000) : "Unexpected counts [expectedBlocks=" + curBlocks + ", actualBlocks=" + evictPlc.getCurrentBlocks() + + ", expectedBytes=" + curBytes + ", currentBytes=" + curBytes + ']'; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java index bde395b..255e319 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java @@ -57,13 +57,13 @@ public class IgfsCacheSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheName(META_CACHE_NAME); igfsCfg.setDataCacheName(DATA_CACHE_NAME); igfsCfg.setName("igfs"); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java index 2e48648..297cc7b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java @@ -24,7 +24,6 @@ import org.apache.ignite.igfs.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -96,7 +95,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheName(META_CACHE_NAME); igfsCfg.setDataCacheName(DATA_CACHE_NAME); @@ -104,7 +103,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest { igfsCfg.setName("igfs"); igfsCfg.setBlockSize(BLOCK_SIZE); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java index 327d7fa..f44a988 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java @@ -28,8 +28,8 @@ import java.io.*; import java.util.*; import java.util.concurrent.*; -import static org.apache.ignite.IgniteFs.*; import static org.apache.ignite.igfs.IgfsMode.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; /** * Tests for IGFS working in mode when remote file system exists: DUAL_SYNC, DUAL_ASYNC. @@ -1120,7 +1120,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { create(igfsSecondary, paths(DIR, SUBDIR), null); create(igfs, null, null); - createFile(igfsSecondary, FILE, true, chunk); + createFile(igfsSecondary.asSecondary(), FILE, true, chunk); checkFileContent(igfs, FILE, chunk); } @@ -1148,7 +1148,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { out.close(); - awaitFileClose(igfsSecondary, FILE); + awaitFileClose(igfsSecondary.asSecondary(), FILE); // Read the first block. int totalRead = 0; @@ -1227,7 +1227,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { out.close(); - awaitFileClose(igfsSecondary, FILE); + awaitFileClose(igfsSecondary.asSecondary(), FILE); // Read the first two blocks. int totalRead = 0; @@ -1292,7 +1292,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { igfsSecondary.update(SUBDIR, props); - createFile(igfs, FILE, true, chunk); + createFile(igfs.asSecondary(), FILE, true, chunk); // Ensure that directory structure was created. checkExist(igfs, igfsSecondary, SUBDIR); @@ -1317,7 +1317,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { igfsSecondary.update(DIR, propsDir); igfsSecondary.update(SUBDIR, propsSubDir); - createFile(igfs, FILE, true, chunk); + createFile(igfs.asSecondary(), FILE, true, chunk); checkExist(igfs, igfsSecondary, SUBDIR); checkFile(igfs, igfsSecondary, FILE, chunk); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java index 1a52b7c..11d6cc5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java @@ -75,13 +75,13 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheName(META_CACHE_NAME); igfsCfg.setDataCacheName(DATA_CACHE_NAME); igfsCfg.setName("igfs"); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java index be5afe7..0af1dea 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java @@ -56,10 +56,10 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); /** Primary IGFS instances. */ - private static IgniteFs[] igfsPrimary; + private static IgniteFileSystem[] igfsPrimary; /** Secondary IGFS instance. */ - private static IgniteFs igfsSecondary; + private static IgfsImpl igfsSecondary; /** Primary file system block size. */ public static final int PRIMARY_BLOCK_SIZE = 512; @@ -84,7 +84,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ private void startPrimary() throws Exception { - igfsPrimary = new IgniteFs[NODES_CNT]; + igfsPrimary = new IgniteFileSystem[NODES_CNT]; for (int i = 0; i < NODES_CNT; i++) { Ignite g = G.start(primaryConfiguration(i)); @@ -101,14 +101,14 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ private IgniteConfiguration primaryConfiguration(int idx) throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); igfsCfg.setName(IGFS_PRIMARY); igfsCfg.setBlockSize(PRIMARY_BLOCK_SIZE); igfsCfg.setDefaultMode(PRIMARY); - igfsCfg.setSecondaryFileSystem(igfsSecondary); + igfsCfg.setSecondaryFileSystem(igfsSecondary.asSecondary()); Map<String, IgfsMode> pathModes = new HashMap<>(); @@ -146,7 +146,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); @@ -159,7 +159,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ private void startSecondary() throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); @@ -198,18 +198,18 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); Ignite g = G.start(cfg); - igfsSecondary = g.fileSystem(IGFS_SECONDARY); + igfsSecondary = (IgfsImpl)g.fileSystem(IGFS_SECONDARY); } /** @throws Exception If failed. */ public void testMetrics() throws Exception { - IgniteFs fs = igfsPrimary[0]; + IgniteFileSystem fs = igfsPrimary[0]; assertNotNull(fs); @@ -349,7 +349,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { /** @throws Exception If failed. */ public void testMultipleClose() throws Exception { - IgniteFs fs = igfsPrimary[0]; + IgniteFileSystem fs = igfsPrimary[0]; IgfsOutputStream out = fs.create(new IgfsPath("/file"), false); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java index 2b501f7..4a58285 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java @@ -82,7 +82,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { private void startUp() throws Exception { startUpSecondary(); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("partitioned"); igfsCfg.setMetaCacheName("replicated"); @@ -97,7 +97,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { igfsCfg.setPathModes(pathModes); if (setSecondaryFs) - igfsCfg.setSecondaryFileSystem(igfsSecondary); + igfsCfg.setSecondaryFileSystem(igfsSecondary.asSecondary()); CacheConfiguration cacheCfg = defaultCacheConfiguration(); @@ -128,7 +128,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(metaCacheCfg, cacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); @@ -144,7 +144,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ private void startUpSecondary() throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("partitioned"); igfsCfg.setMetaCacheName("replicated"); @@ -185,7 +185,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(metaCacheCfg, cacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); @@ -378,7 +378,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { } assertTrue(errMsg.startsWith( - "Grid configuration parameter invalid: secondaryFileSystem cannot be null when mode is SECONDARY")); + "Grid configuration parameter invalid: secondaryFileSystem cannot be null when mode is not PRIMARY")); } /** @@ -444,7 +444,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { } assertTrue(errMsg.startsWith( - "Grid configuration parameter invalid: secondaryFileSystem cannot be null when mode is SECONDARY")); + "Grid configuration parameter invalid: secondaryFileSystem cannot be null when mode is not PRIMARY")); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java index ead7511..0e03aa8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java @@ -59,7 +59,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { protected final SecureRandom rnd = new SecureRandom(); /** File system. */ - protected IgniteFs igfs; + protected IgniteFileSystem igfs; /** Meta cache. */ private GridCache<Object, Object> metaCache; @@ -73,7 +73,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { igfs = grid.fileSystem(igfsName()); - IgfsConfiguration[] cfgs = grid.configuration().getIgfsConfiguration(); + FileSystemConfiguration[] cfgs = grid.configuration().getFileSystemConfiguration(); assert cfgs.length == 1; @@ -111,13 +111,13 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheName(META_CACHE_NAME); igfsCfg.setDataCacheName(DATA_CACHE_NAME); igfsCfg.setName("igfs"); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } @@ -157,7 +157,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest { /** @throws Exception If failed. */ public void testigfsEnabled() throws Exception { - IgniteFs igfs = grid(0).fileSystem(igfsName()); + IgniteFileSystem igfs = grid(0).fileSystem(igfsName()); assertNotNull(igfs); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java index 6f444c0..dcd0413 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java @@ -37,7 +37,7 @@ import static org.apache.ignite.igfs.IgfsMode.*; * Tests for node validation logic in {@link IgfsProcessor}. * <p> * Tests starting with "testLocal" are checking - * {@link IgfsProcessor#validateLocalIgfsConfigurations(org.apache.ignite.configuration.IgfsConfiguration[])}. + * {@link IgfsProcessor#validateLocalIgfsConfigurations(org.apache.ignite.configuration.FileSystemConfiguration[])}. * <p> * Tests starting with "testRemote" are checking {@link IgfsProcessor#checkIgfsOnRemoteNode(org.apache.ignite.cluster.ClusterNode)}. */ @@ -61,10 +61,10 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { private static final String metaCache2Name = "metaCache2"; /** First IGFS config in grid #1. */ - private IgfsConfiguration g1IgfsCfg1 = new IgfsConfiguration(); + private FileSystemConfiguration g1IgfsCfg1 = new FileSystemConfiguration(); /** Second IGFS config in grid#1. */ - private IgfsConfiguration g1IgfsCfg2 = new IgfsConfiguration(); + private FileSystemConfiguration g1IgfsCfg2 = new FileSystemConfiguration(); /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { @@ -89,7 +89,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g1IgfsCfg2.setDataCacheName(dataCache2Name); g1IgfsCfg2.setMetaCacheName(metaCache2Name); - cfg.setIgfsConfiguration(g1IgfsCfg1, g1IgfsCfg2); + cfg.setFileSystemConfiguration(g1IgfsCfg1, g1IgfsCfg2); cfg.setLocalHost("127.0.0.1"); @@ -266,7 +266,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g1IgfsCfg2.setDefaultMode(PROXY); - checkGridStartFails(g1Cfg, "secondaryFileSystem cannot be null when mode is SECONDARY", true); + checkGridStartFails(g1Cfg, "secondaryFileSystem cannot be null when mode is not PRIMARY", true); } /** @@ -278,11 +278,11 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); g2Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); g2IgfsCfg1.setBlockSize(g2IgfsCfg1.getBlockSize() + 100); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g1IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g1IgfsCfg2); G.start(g1Cfg); @@ -310,8 +310,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfMetaCacheNameDiffers() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g2IgfsCfg1.setMetaCacheName("g2MetaCache1"); g2IgfsCfg2.setMetaCacheName("g2MetaCache2"); @@ -320,7 +320,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g2Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches("g2MetaCache1", "g2MetaCache2"), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); @@ -333,8 +333,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfMetaCacheNameEquals() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g2IgfsCfg1.setName("g2IgfsCfg1"); g2IgfsCfg2.setName("g2IgfsCfg2"); @@ -346,7 +346,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g2Cfg.setCacheConfiguration(concat(dataCaches(1024, "g2DataCache1", "g2DataCache2"), metaCaches(), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); @@ -359,8 +359,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfDataCacheNameDiffers() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g2IgfsCfg1.setDataCacheName("g2DataCache1"); g2IgfsCfg2.setDataCacheName("g2DataCache2"); @@ -369,7 +369,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g2Cfg.setCacheConfiguration(concat(dataCaches(1024, "g2DataCache1", "g2DataCache2"), metaCaches(), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); @@ -382,8 +382,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfDataCacheNameEquals() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g2IgfsCfg1.setName("g2IgfsCfg1"); g2IgfsCfg2.setName("g2IgfsCfg2"); @@ -395,7 +395,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g2Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches("g2MetaCache1", "g2MetaCache2"), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); @@ -408,8 +408,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfDefaultModeDiffers() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g1IgfsCfg1.setDefaultMode(DUAL_ASYNC); g1IgfsCfg2.setDefaultMode(DUAL_ASYNC); @@ -420,7 +420,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); g2Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); @@ -433,8 +433,8 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { public void testRemoteIfPathModeDiffers() throws Exception { IgniteConfiguration g2Cfg = getConfiguration("g2"); - IgfsConfiguration g2IgfsCfg1 = new IgfsConfiguration(g1IgfsCfg1); - IgfsConfiguration g2IgfsCfg2 = new IgfsConfiguration(g1IgfsCfg2); + FileSystemConfiguration g2IgfsCfg1 = new FileSystemConfiguration(g1IgfsCfg1); + FileSystemConfiguration g2IgfsCfg2 = new FileSystemConfiguration(g1IgfsCfg2); g2IgfsCfg1.setPathModes(Collections.singletonMap("/somePath", DUAL_SYNC)); g2IgfsCfg2.setPathModes(Collections.singletonMap("/somePath", DUAL_SYNC)); @@ -442,7 +442,7 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest { g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); g2Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class)); - g2Cfg.setIgfsConfiguration(g2IgfsCfg1, g2IgfsCfg2); + g2Cfg.setFileSystemConfiguration(g2IgfsCfg1, g2IgfsCfg2); G.start(g1Cfg); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java index ee8e7bd..694d5c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java @@ -36,7 +36,7 @@ import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.configuration.IgfsConfiguration.*; +import static org.apache.ignite.configuration.FileSystemConfiguration.*; /** * Base test class for {@link IgfsServer} checking IPC endpoint registrations. @@ -58,7 +58,7 @@ public abstract class IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest e public void testLoopbackEndpointsRegistration() throws Exception { IgniteConfiguration cfg = gridConfiguration(); - cfg.setIgfsConfiguration( + cfg.setFileSystemConfiguration( igfsConfiguration("tcp", DFLT_IPC_PORT, null) ); @@ -77,7 +77,7 @@ public abstract class IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest e public void testLoopbackEndpointsCustomHostRegistration() throws Exception { IgniteConfiguration cfg = gridConfiguration(); - cfg.setIgfsConfiguration( + cfg.setFileSystemConfiguration( igfsConfiguration("tcp", DFLT_IPC_PORT, "127.0.0.1"), igfsConfiguration("tcp", DFLT_IPC_PORT + 1, U.getLocalHost().getHostName())); @@ -154,7 +154,7 @@ public abstract class IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest e * @param endPntHost End point host. * @return test-purposed IgfsConfiguration. */ - protected IgfsConfiguration igfsConfiguration(@Nullable String endPntType, @Nullable Integer endPntPort, + protected FileSystemConfiguration igfsConfiguration(@Nullable String endPntType, @Nullable Integer endPntPort, @Nullable String endPntHost) throws IgniteCheckedException { HashMap<String, String> endPntCfg = null; @@ -170,7 +170,7 @@ public abstract class IgfsServerManagerIpcEndpointRegistrationAbstractSelfTest e endPntCfg.put("host", endPntHost); } - IgfsConfiguration igfsConfiguration = new IgfsConfiguration(); + FileSystemConfiguration igfsConfiguration = new FileSystemConfiguration(); igfsConfiguration.setDataCacheName("partitioned"); igfsConfiguration.setMetaCacheName("replicated"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest.java index d7319f4..57f10d9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest.java @@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.igfs; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.typedef.*; -import static org.apache.ignite.configuration.IgfsConfiguration.*; +import static org.apache.ignite.configuration.FileSystemConfiguration.*; /** * Tests for {@link IgfsServer} that checks all IPC endpoint registration types @@ -34,7 +34,7 @@ public class IgfsServerManagerIpcEndpointRegistrationOnLinuxAndMacSelfTest public void testLoopbackAndShmemEndpointsRegistration() throws Exception { IgniteConfiguration cfg = gridConfiguration(); - cfg.setIgfsConfiguration( + cfg.setFileSystemConfiguration( igfsConfiguration(null, null, null), // Check null IPC endpoint config won't bring any hassles. igfsConfiguration("tcp", DFLT_IPC_PORT + 1, null), igfsConfiguration("shmem", DFLT_IPC_PORT + 2, null)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest.java index 259f31a..4f18aff 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest.java @@ -40,7 +40,7 @@ public class IgfsServerManagerIpcEndpointRegistrationOnWindowsSelfTest @Override public Object call() throws Exception { IgniteConfiguration cfg = gridConfiguration(); - cfg.setIgfsConfiguration(igfsConfiguration("shmem", IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, + cfg.setFileSystemConfiguration(igfsConfiguration("shmem", IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, null)); return G.start(cfg); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java index b212f02..c62e759 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java @@ -111,7 +111,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName(DATA_CACHE_NAME); igfsCfg.setMetaCacheName(META_CACHE_NAME); @@ -154,7 +154,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(metaCfg, dataCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java index 054665d..25816c7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java @@ -74,7 +74,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest { public static final int ASSERT_RETRY_INTERVAL = 100; /** File system to test. */ - private IgniteFs fs; + private IgniteFileSystem fs; /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { @@ -110,7 +110,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheName(META_CACHE_NAME); igfsCfg.setDataCacheName(DATA_CACHE_NAME); @@ -118,7 +118,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest { igfsCfg.setBlockSize(CFG_BLOCK_SIZE); igfsCfg.setFragmentizerEnabled(true); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); return cfg; } @@ -229,12 +229,12 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest { IgfsPath path = new IgfsPath("/file"); try { - IgniteFs fs0 = grid(0).fileSystem("igfs"); - IgniteFs fs1 = grid(1).fileSystem("igfs"); - IgniteFs fs2 = grid(2).fileSystem("igfs"); + IgniteFileSystem fs0 = grid(0).fileSystem("igfs"); + IgniteFileSystem fs1 = grid(1).fileSystem("igfs"); + IgniteFileSystem fs2 = grid(2).fileSystem("igfs"); try (IgfsOutputStream out = fs0.create(path, 128, false, 1, CFG_GRP_SIZE, - F.asMap(IgniteFs.PROP_PREFER_LOCAL_WRITES, "true"))) { + F.asMap(IgfsEx.PROP_PREFER_LOCAL_WRITES, "true"))) { // 1.5 blocks byte[] data = new byte[CFG_BLOCK_SIZE * 3 / 2]; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java index 5b7a636..d1778df 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java @@ -68,7 +68,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest { private static final int REPEAT_CNT = 10; /** IGFS. */ - private static IgniteFs igfs; + private static IgniteFileSystem igfs; /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { @@ -97,7 +97,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest { * @return Grid configuration */ private IgniteConfiguration config(int idx) { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); @@ -133,7 +133,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); cfg.setGridName("node-" + idx); @@ -172,7 +172,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest { assertFalse(igfs.isAsync()); - IgniteFs igfsAsync = igfs.withAsync(); + IgniteFileSystem igfsAsync = igfs.withAsync(); assertTrue(igfsAsync.isAsync()); @@ -269,7 +269,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest { private ComputeJobContext ctx; /** {@inheritDoc} */ - @Override public Object execute(IgniteFs igfs, IgfsFileRange range, IgfsInputStream in) + @Override public Object execute(IgniteFileSystem igfs, IgfsFileRange range, IgfsInputStream in) throws IOException { assert ignite != null; assert ses != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6423cf02/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java index 05de61a..487d391 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java @@ -46,11 +46,11 @@ public class IgfsAbstractRecordResolverSelfTest extends GridCommonAbstractTest { private final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); /** IGFS. */ - protected static IgniteFs igfs; + protected static IgniteFileSystem igfs; /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - IgfsConfiguration igfsCfg = new IgfsConfiguration(); + FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); @@ -87,7 +87,7 @@ public class IgfsAbstractRecordResolverSelfTest extends GridCommonAbstractTest { cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); - cfg.setIgfsConfiguration(igfsCfg); + cfg.setFileSystemConfiguration(igfsCfg); Ignite g = G.start(cfg);