Repository: ignite Updated Branches: refs/heads/ignite-3405-1 [created] 44d678447
Squashed commit of the following: commit 24ecefe1cdaa93a6849a8aba31893b20ee01f0f3 Merge: f483499 aedfde6 Author: vozerov-gridgain <[email protected]> Date: Wed Jul 20 12:49:20 2016 +0300 Merge branch 'gridgain-7.5.30' into ignite-3405 commit f48349962dec205c6edc0e1e314dc60ecd795e43 Author: vozerov-gridgain <[email protected]> Date: Tue Jul 5 16:39:49 2016 +0300 IGNITE-3405: Review (4). commit 2e69961f1453972982fd6a869d745e10de6d236f Author: vozerov-gridgain <[email protected]> Date: Tue Jul 5 16:22:27 2016 +0300 IGNITE-3405: Review (3). commit a646ebd6a830496fdc86532ffe3659a6ef13bc21 Author: vozerov-gridgain <[email protected]> Date: Tue Jul 5 16:22:16 2016 +0300 IGNITE-3405: Review (2). commit e610e543c97dfa9a61292fb381890481044858c3 Author: vozerov-gridgain <[email protected]> Date: Tue Jul 5 16:19:35 2016 +0300 IGNITE-3405: Review. commit 9ee3c9eaaf79bc443521b58c726688657eb915e2 Merge: 87983dd 093924b Author: vozerov-gridgain <[email protected]> Date: Tue Jul 5 16:12:29 2016 +0300 Merge branch 'gridgain-7.5.29' into ignite-3405 commit 87983dda34fcad1532819eadd53668604affc60e Author: iveselovskiy <[email protected]> Date: Tue Jul 5 14:41:57 2016 +0300 IGNITE-3405: isSubdirectoryOf() fixed. commit c9eaf5c286eb7b697df155b5997e0410a0552f86 Author: iveselovskiy <[email protected]> Date: Tue Jul 5 13:22:17 2016 +0300 IGNITE-3405: reverted unnecessary changes. commit 197eb07fba06edb6d904e4a3b278e04c013ff11b Author: iveselovskiy <[email protected]> Date: Tue Jul 5 13:11:40 2016 +0300 IGNITE-3405: fixed by review results-2. commit 05cb2f5d86805736e92e37dd9cede90b38ea3690 Author: iveselovskiy <[email protected]> Date: Mon Jul 4 17:56:28 2016 +0300 IGNITE-3405: fixed import. commit 8ddf29b7741d2bef1eaf61e189c38ccf4b60f58c Author: iveselovskiy <[email protected]> Date: Mon Jul 4 17:48:28 2016 +0300 IGNITE-3405: fixed imports. commit 3cd76acb88d54aa3bf3bb15312c4d538b514fe40 Author: iveselovskiy <[email protected]> Date: Mon Jul 4 17:36:02 2016 +0300 IGNITE-3405: refactored after review results.. commit d4d2c2e45369d26cad693ed3a6bee239fc08243b Author: iveselovskiy <[email protected]> Date: Fri Jul 1 21:10:51 2016 +0300 IGNITE-3405: removed resolveChildrenMode commit e12df67b1d6d15facb042a826a5c98e5a5d801a9 Author: iveselovskiy <[email protected]> Date: Fri Jul 1 19:56:42 2016 +0300 IGNITE-3405: cosmetic corrections 2. commit 160b20217f94aa300ffde2404ec6b8344c8bc210 Author: iveselovskiy <[email protected]> Date: Fri Jul 1 19:45:05 2016 +0300 IGNITE-3405: cosmetic corrections commit b4bb9c5392afff1645e288168f376c813e1cdec3 Author: iveselovskiy <[email protected]> Date: Fri Jul 1 19:06:03 2016 +0300 IGNITE-3405: version ready for TC. commit ef722e8dd524ca96fbf68e1d83229ea51c114233 Author: iveselovskiy <[email protected]> Date: Thu Jun 30 22:35:08 2016 +0300 3405: logic implemented (though not tested yet). Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44d67844 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44d67844 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44d67844 Branch: refs/heads/ignite-3405-1 Commit: 44d67844715d9e32078346fbe46a93149f5c2714 Parents: 51add50 Author: vozerov-gridgain <[email protected]> Authored: Wed Jul 20 12:52:29 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Jul 20 12:52:29 2016 +0300 ---------------------------------------------------------------------- .../internal/processors/igfs/IgfsImpl.java | 77 +++--------- .../processors/igfs/IgfsModeResolver.java | 94 ++------------ .../internal/processors/igfs/IgfsUtils.java | 83 +++++++++++++ ...sCachePerBlockLruEvictionPolicySelfTest.java | 7 +- .../processors/igfs/IgfsMetricsSelfTest.java | 54 ++++---- .../igfs/IgfsModeResolverSelfTest.java | 124 ++++++++++++++----- .../processors/igfs/IgfsModesSelfTest.java | 61 ++++----- .../hadoop/fs/v2/IgniteHadoopFileSystem.java | 22 ++-- 8 files changed, 275 insertions(+), 247 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java index efb347f..5b87698 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java @@ -94,7 +94,6 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; @@ -210,7 +209,7 @@ public final class IgfsImpl implements IgfsEx { Map<String, IgfsMode> cfgModes = new LinkedHashMap<>(); Map<String, IgfsMode> dfltModes = new LinkedHashMap<>(4, 1.0f); - if (cfg.isInitializeDefaultPathModes()) { + if (cfg.isInitializeDefaultPathModes() && IgfsUtils.isDualMode(dfltMode)) { dfltModes.put("/ignite/primary", PRIMARY); if (secondaryFs != null) { @@ -222,8 +221,8 @@ public final class IgfsImpl implements IgfsEx { cfgModes.putAll(dfltModes); - if (igfsCtx.configuration().getPathModes() != null) { - for (Map.Entry<String, IgfsMode> e : igfsCtx.configuration().getPathModes().entrySet()) { + if (cfg.getPathModes() != null) { + for (Map.Entry<String, IgfsMode> e : cfg.getPathModes().entrySet()) { if (!dfltModes.containsKey(e.getKey())) cfgModes.put(e.getKey(), e.getValue()); else @@ -249,7 +248,7 @@ public final class IgfsImpl implements IgfsEx { } } - modeRslvr = new IgfsModeResolver(dfltMode, modes); + modeRslvr = new IgfsModeResolver(dfltMode, IgfsUtils.preparePathModes(dfltMode, modes)); Object secondaryFsPayload = null; @@ -620,7 +619,7 @@ public final class IgfsImpl implements IgfsEx { IgfsMode mode = resolveMode(path); if (mode != PRIMARY) { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + assert IgfsUtils.isDualMode(mode); await(path); @@ -671,8 +670,6 @@ public final class IgfsImpl implements IgfsEx { IgfsMode mode = resolveMode(src); - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(src); - if (src.equals(dest)) return null; // Rename to itself is a no-op. @@ -689,8 +686,8 @@ public final class IgfsImpl implements IgfsEx { throw new IgfsInvalidPathException("Cannot move file to a path with different eviction " + "exclude setting (need to copy and remove)"); - if (!childrenModes.equals(Collections.singleton(PRIMARY))) { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + if (mode != PRIMARY) { + assert IgfsUtils.isDualMode(mode); // PROXY mode explicit usage is forbidden. await(src, dest); @@ -721,9 +718,9 @@ public final class IgfsImpl implements IgfsEx { if (IgfsPath.SLASH.equals(path.toString())) return false; - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(path); + IgfsMode mode = resolveMode(path); - boolean dual = childrenModes.contains(DUAL_SYNC) ||childrenModes.contains(DUAL_ASYNC); + boolean dual = IgfsUtils.isDualMode(mode);; if (dual) await(path); @@ -767,7 +764,7 @@ public final class IgfsImpl implements IgfsEx { if (mode == PRIMARY) meta.mkdirs(path, props0); else { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + assert IgfsUtils.isDualMode(mode);; await(path); @@ -794,11 +791,9 @@ public final class IgfsImpl implements IgfsEx { IgfsMode mode = resolveMode(path); - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(path); - Collection<String> files = new HashSet<>(); - if (childrenModes.contains(DUAL_SYNC) || childrenModes.contains(DUAL_ASYNC)) { + if (IgfsUtils.isDualMode(mode)) { assert secondaryFs != null; try { @@ -818,11 +813,8 @@ public final class IgfsImpl implements IgfsEx { if (fileId != null) files.addAll(meta.directoryListing(fileId).keySet()); - else if (mode == PRIMARY) { - checkConflictWithPrimary(path); - + else if (mode == PRIMARY) throw new IgfsPathNotFoundException("Failed to list files (path not found): " + path); - } return F.viewReadOnly(files, new C1<String, IgfsPath>() { @Override public IgfsPath apply(String e) { @@ -847,11 +839,9 @@ public final class IgfsImpl implements IgfsEx { IgfsMode mode = resolveMode(path); - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(path); - Collection<IgfsFile> files = new HashSet<>(); - if (childrenModes.contains(DUAL_SYNC) || childrenModes.contains(DUAL_ASYNC)) { + if (IgfsUtils.isDualMode(mode)) { assert secondaryFs != null; try { @@ -894,11 +884,8 @@ public final class IgfsImpl implements IgfsEx { } } } - else if (mode == PRIMARY) { - checkConflictWithPrimary(path); - + else if (mode == PRIMARY) throw new IgfsPathNotFoundException("Failed to list files (path not found): " + path); - } return files; } @@ -937,7 +924,7 @@ public final class IgfsImpl implements IgfsEx { IgfsMode mode = resolveMode(path); if (mode != PRIMARY) { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + assert IgfsUtils.isDualMode(mode); IgfsSecondaryInputStreamDescriptor desc = meta.openDual(secondaryFs, path, bufSize0); @@ -951,11 +938,8 @@ public final class IgfsImpl implements IgfsEx { IgfsEntryInfo info = meta.infoForPath(path); - if (info == null) { - checkConflictWithPrimary(path); - + if (info == null) throw new IgfsPathNotFoundException("File not found: " + path); - } if (!info.isFile()) throw new IgfsPathIsDirectoryException("Failed to open file (not a file): " + path); @@ -1089,7 +1073,7 @@ public final class IgfsImpl implements IgfsEx { IgfsFileWorkerBatch batch; if (mode != PRIMARY) { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + assert IgfsUtils.isDualMode(mode); await(path); @@ -1105,11 +1089,8 @@ public final class IgfsImpl implements IgfsEx { final IgniteUuid id = ids.get(ids.size() - 1); if (id == null) { - if (!create) { - checkConflictWithPrimary(path); - + if (!create) throw new IgfsPathNotFoundException("File not found: " + path); - } } // Prevent attempt to append to ROOT in early stage: @@ -1160,11 +1141,8 @@ public final class IgfsImpl implements IgfsEx { @Override public Void call() throws Exception { FileDescriptor desc = getFileDescriptor(path); - if (desc == null) { - checkConflictWithPrimary(path); - + if (desc == null) throw new IgfsPathNotFoundException("Failed to update times (path not found): " + path); - } // Cannot update times for root. if (desc.parentId == null) @@ -1177,21 +1155,6 @@ public final class IgfsImpl implements IgfsEx { }); } - /** - * Checks if given path exists in secondary file system and throws exception if so. - * - * @param path Path to check. - * @throws IgniteCheckedException If path exists. - */ - private void checkConflictWithPrimary(IgfsPath path) throws IgniteCheckedException { - if (secondaryFs != null) { - if (secondaryFs.info(path) != null) { - throw new IgfsInvalidPathException("Path mapped to a PRIMARY mode found in secondary file " + - "system. Remove path from secondary file system or change path mapping: " + path); - } - } - } - /** {@inheritDoc} */ @Override public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len) { return affinity(path, start, len, 0L); @@ -1218,7 +1181,7 @@ public final class IgfsImpl implements IgfsEx { IgfsEntryInfo info = meta.infoForPath(path); if (info == null && mode != PRIMARY) { - assert mode == DUAL_SYNC || mode == DUAL_ASYNC; + assert IgfsUtils.isDualMode(mode); assert secondaryFs != null; // Synchronize http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java index 70da103..907051f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java @@ -17,13 +17,9 @@ package org.apache.ignite.internal.processors.igfs; -import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.apache.ignite.igfs.IgfsMode; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap; @@ -41,39 +37,26 @@ public class IgfsModeResolver { private final IgfsMode dfltMode; /** Modes for particular paths. Ordered from longest to shortest. */ - private ArrayList<T2<IgfsPath, IgfsMode>> modes; + private List<T2<IgfsPath, IgfsMode>> modes; /** Cached modes per path. */ private Map<IgfsPath, IgfsMode> modesCache; - /** Cached children modes per path. */ - private Map<IgfsPath, Set<IgfsMode>> childrenModesCache; - /** + * Constructor + * * @param dfltMode Default IGFS mode. - * @param modes List of configured modes. + * @param modes List of configured modes. The order is significant as modes are added in order of occurrence. */ public IgfsModeResolver(IgfsMode dfltMode, @Nullable List<T2<IgfsPath, IgfsMode>> modes) { assert dfltMode != null; this.dfltMode = dfltMode; - if (modes != null) { - ArrayList<T2<IgfsPath, IgfsMode>> modes0 = new ArrayList<>(modes); - - // Sort paths, longest first. - Collections.sort(modes0, new Comparator<Map.Entry<IgfsPath, IgfsMode>>() { - @Override public int compare(Map.Entry<IgfsPath, IgfsMode> o1, - Map.Entry<IgfsPath, IgfsMode> o2) { - return o2.getKey().components().size() - o1.getKey().components().size(); - } - }); - - this.modes = modes0; + this.modes = modes; + if (modes != null) modesCache = new GridBoundedConcurrentLinkedHashMap<>(MAX_PATH_CACHE); - childrenModesCache = new GridBoundedConcurrentLinkedHashMap<>(MAX_PATH_CACHE); - } } /** @@ -92,7 +75,7 @@ public class IgfsModeResolver { if (mode == null) { for (T2<IgfsPath, IgfsMode> entry : modes) { - if (startsWith(path, entry.getKey())) { + if (path.isSame(entry.getKey()) || path.isSubDirectoryOf(entry.getKey())) { // As modes ordered from most specific to least specific first mode found is ours. mode = entry.getValue(); @@ -111,73 +94,10 @@ public class IgfsModeResolver { } /** - * @param path Path. - * @return Set of all modes that children paths could have. - */ - public Set<IgfsMode> resolveChildrenModes(IgfsPath path) { - assert path != null; - - if (modes == null) - return Collections.singleton(dfltMode); - else { - Set<IgfsMode> children = childrenModesCache.get(path); - - if (children == null) { - children = new HashSet<>(IgfsMode.values().length, 1.0f); - - IgfsMode pathDefault = dfltMode; - - for (T2<IgfsPath, IgfsMode> child : modes) { - if (startsWith(path, child.getKey())) { - pathDefault = child.getValue(); - - break; - } - else if (startsWith(child.getKey(), path)) - children.add(child.getValue()); - } - - children.add(pathDefault); - - childrenModesCache.put(path, children); - } - - return children; - } - } - - /** * @return Unmodifiable copy of properly ordered modes prefixes * or {@code null} if no modes set. */ @Nullable public List<T2<IgfsPath, IgfsMode>> modesOrdered() { return modes != null ? Collections.unmodifiableList(modes) : null; } - - /** - * Check if path starts with prefix. - * - * @param path Path. - * @param prefix Prefix. - * @return {@code true} if path starts with prefix, {@code false} if not. - */ - private static boolean startsWith(IgfsPath path, IgfsPath prefix) { - List<String> p1Comps = path.components(); - List<String> p2Comps = prefix.components(); - - if (p2Comps.size() > p1Comps.size()) - return false; - - for (int i = 0; i < p1Comps.size(); i++) { - if (i >= p2Comps.size() || p2Comps.get(i) == null) - // All prefix components already matched. - return true; - - if (!p1Comps.get(i).equals(p2Comps.get(i))) - return false; - } - - // Path and prefix components had same length and all of them matched. - return true; - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java index 7310b4c..03b7611 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java @@ -31,6 +31,7 @@ import org.apache.ignite.configuration.FileSystemConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.events.IgfsEvent; import org.apache.ignite.igfs.IgfsException; +import org.apache.ignite.igfs.IgfsMode; import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.GridKernalContext; @@ -42,6 +43,7 @@ import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.future.IgniteFutureImpl; import org.apache.ignite.internal.util.lang.IgniteOutClosureX; import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteUuid; @@ -52,12 +54,18 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_RETRIES_COUNT; +import static org.apache.ignite.igfs.IgfsMode.DUAL_ASYNC; +import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGFS; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -784,4 +792,79 @@ public class IgfsUtils { return false; } + + /** + * Check whether mode is dual. + * + * @param mode Mode. + * @return {@code True} if dual. + */ + public static boolean isDualMode(IgfsMode mode) { + return mode == DUAL_SYNC || mode == DUAL_ASYNC; + } + + /** + * Answers if directory of this mode can contain a subdirectory of the given mode. + * + * @param parent Parent mode. + * @param child Child mode. + * @return {@code true} if directory of this mode can contain a directory of the given mode. + */ + public static boolean canContain(IgfsMode parent, IgfsMode child) { + return isDualMode(parent) || parent == child; + } + + /** + * Checks, filters and sorts the modes. + * + * @param dfltMode The root mode. Must always be not null. + * @param modes The subdirectory modes. + * @return Descending list of filtered and checked modes. + * @throws IgniteCheckedException On error or + */ + public static ArrayList<T2<IgfsPath, IgfsMode>> preparePathModes(final IgfsMode dfltMode, + @Nullable List<T2<IgfsPath, IgfsMode>> modes) throws IgniteCheckedException { + if (modes == null) + return null; + + // Sort by depth, shallow first. + Collections.sort(modes, new Comparator<Map.Entry<IgfsPath, IgfsMode>>() { + @Override public int compare(Map.Entry<IgfsPath, IgfsMode> o1, Map.Entry<IgfsPath, IgfsMode> o2) { + return o1.getKey().depth() - o2.getKey().depth(); + } + }); + + ArrayList<T2<IgfsPath, IgfsMode>> resModes = new ArrayList<>(modes.size() + 1); + + resModes.add(new T2<>(new IgfsPath("/"), dfltMode)); + + for (T2<IgfsPath, IgfsMode> mode : modes) { + assert mode.getKey() != null; + + for (T2<IgfsPath, IgfsMode> resMode : resModes) { + if (mode.getKey().isSubDirectoryOf(resMode.getKey())) { + assert resMode.getValue() != null; + + if (resMode.getValue() == mode.getValue()) + // No reason to add a sub-path of the same mode, ignore this pair. + break; + + if (!canContain(resMode.getValue(), mode.getValue())) + throw new IgniteCheckedException("Subdirectory " + mode.getKey() + " mode " + + mode.getValue() + " is not compatible with upper level " + + resMode.getKey() + " directory mode " + resMode.getValue() + "."); + + // Add to the 1st position (deep first). + resModes.add(0, mode); + + break; + } + } + } + + // Remove root, because this class contract is that root mode is not contained in the list. + resModes.remove(resModes.size() - 1); + + return resModes; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/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 index 8cb8f44..93171ba 100644 --- 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 @@ -102,14 +102,14 @@ public class IgfsCachePerBlockLruEvictionPolicySelfTest extends IgfsCommonAbstra igfsCfg.setMetaCacheName("metaCache"); igfsCfg.setName(IGFS_PRIMARY); igfsCfg.setBlockSize(512); - igfsCfg.setDefaultMode(PRIMARY); + igfsCfg.setDefaultMode(DUAL_SYNC); 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); + pathModes.put(FILE.toString(), PRIMARY); igfsCfg.setPathModes(pathModes); @@ -487,7 +487,8 @@ public class IgfsCachePerBlockLruEvictionPolicySelfTest extends IgfsCommonAbstra * @param curBlocks Current blocks. * @param curBytes Current bytes. */ - private void checkEvictionPolicy(final int curBlocks, final long curBytes) throws IgniteInterruptedCheckedException { + 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; http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/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 fb1d6f7..38cfc00 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 @@ -123,12 +123,12 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { igfsCfg.setMetaCacheName("metaCache"); igfsCfg.setName(IGFS_PRIMARY); igfsCfg.setBlockSize(PRIMARY_BLOCK_SIZE); - igfsCfg.setDefaultMode(PRIMARY); + igfsCfg.setDefaultMode(DUAL_SYNC); igfsCfg.setSecondaryFileSystem(igfsSecondary.asSecondary()); Map<String, IgfsMode> pathModes = new HashMap<>(); - pathModes.put("/fileRemote", DUAL_SYNC); + pathModes.put("/primary", PRIMARY); igfsCfg.setPathModes(pathModes); @@ -233,35 +233,35 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - fs.mkdirs(new IgfsPath("/dir1")); + fs.mkdirs(new IgfsPath("/primary/dir1")); m = fs.metrics(); assertNotNull(m); - assertEquals(1, m.directoriesCount()); + assertEquals(2, m.directoriesCount()); assertEquals(0, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - fs.mkdirs(new IgfsPath("/dir1/dir2/dir3")); - fs.mkdirs(new IgfsPath("/dir4")); + fs.mkdirs(new IgfsPath("/primary/dir1/dir2/dir3")); + fs.mkdirs(new IgfsPath("/primary/dir4")); m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(0, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - IgfsOutputStream out1 = fs.create(new IgfsPath("/dir1/file1"), false); - IgfsOutputStream out2 = fs.create(new IgfsPath("/dir1/file2"), false); - IgfsOutputStream out3 = fs.create(new IgfsPath("/dir1/dir2/file"), false); + IgfsOutputStream out1 = fs.create(new IgfsPath("/primary/dir1/file1"), false); + IgfsOutputStream out2 = fs.create(new IgfsPath("/primary/dir1/file2"), false); + IgfsOutputStream out3 = fs.create(new IgfsPath("/primary/dir1/dir2/file"), false); m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(3, m.filesOpenedForWrite()); @@ -275,7 +275,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(2, m.filesOpenedForWrite()); @@ -286,19 +286,19 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - IgfsOutputStream out = fs.append(new IgfsPath("/dir1/file1"), false); + IgfsOutputStream out = fs.append(new IgfsPath("/primary/dir1/file1"), false); out.write(new byte[20]); m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(1, m.filesOpenedForWrite()); @@ -310,18 +310,18 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - IgfsInputStream in1 = fs.open(new IgfsPath("/dir1/file1")); - IgfsInputStream in2 = fs.open(new IgfsPath("/dir1/file2")); + IgfsInputStream in1 = fs.open(new IgfsPath("/primary/dir1/file1")); + IgfsInputStream in2 = fs.open(new IgfsPath("/primary/dir1/file2")); m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(2, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); @@ -332,18 +332,18 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { m = fs.metrics(); assertNotNull(m); - assertEquals(4, m.directoriesCount()); + assertEquals(5, m.directoriesCount()); assertEquals(3, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); - fs.delete(new IgfsPath("/dir1/file1"), false); - fs.delete(new IgfsPath("/dir1/dir2"), true); + fs.delete(new IgfsPath("/primary/dir1/file1"), false); + fs.delete(new IgfsPath("/primary/dir1/dir2"), true); m = fs.metrics(); assertNotNull(m); - assertEquals(2, m.directoriesCount()); + assertEquals(3, m.directoriesCount()); assertEquals(1, m.filesCount()); assertEquals(0, m.filesOpenedForRead()); assertEquals(0, m.filesOpenedForWrite()); @@ -363,12 +363,12 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { public void testMultipleClose() throws Exception { IgniteFileSystem fs = igfsPrimary[0]; - IgfsOutputStream out = fs.create(new IgfsPath("/file"), false); + IgfsOutputStream out = fs.create(new IgfsPath("/primary/file"), false); out.close(); out.close(); - IgfsInputStream in = fs.open(new IgfsPath("/file")); + IgfsInputStream in = fs.open(new IgfsPath("/primary/file")); in.close(); in.close(); @@ -388,8 +388,8 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest { IgfsEx igfs = (IgfsEx)igfsPrimary[0]; IgfsPath fileRemote = new IgfsPath("/fileRemote"); - IgfsPath file1 = new IgfsPath("/file1"); - IgfsPath file2 = new IgfsPath("/file2"); + IgfsPath file1 = new IgfsPath("/primary/file1"); + IgfsPath file2 = new IgfsPath("/primary/file2"); // Create remote file and write some data to it. IgfsOutputStream out = igfsSecondary.create(fileRemote, 256, true, null, 1, 256, null); http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java index a05ddfc..f3bb516 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java @@ -18,12 +18,13 @@ package org.apache.ignite.internal.processors.igfs; import java.util.Arrays; -import java.util.HashSet; +import java.util.List; import junit.framework.TestCase; +import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.igfs.IgfsMode; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.util.typedef.T2; - +import static org.apache.ignite.igfs.IgfsMode.DUAL_ASYNC; import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC; import static org.apache.ignite.igfs.IgfsMode.PRIMARY; import static org.apache.ignite.igfs.IgfsMode.PROXY; @@ -33,48 +34,109 @@ import static org.apache.ignite.igfs.IgfsMode.PROXY; */ public class IgfsModeResolverSelfTest extends TestCase { /** */ - private IgfsModeResolver resolver; + private IgfsModeResolver reslvr; /** {@inheritDoc} */ @Override protected void setUp() throws Exception { - resolver = new IgfsModeResolver(DUAL_SYNC, Arrays.asList( - new T2<>(new IgfsPath("/a/b/"), PRIMARY), - new T2<>(new IgfsPath("/a/b/c/d"), PROXY))); + reslvr = new IgfsModeResolver(DUAL_SYNC, Arrays.asList(new T2<>(new IgfsPath("/a/b/c/d"), PROXY), new T2<> + (new IgfsPath("/a/P/"), PRIMARY), new T2<>(new IgfsPath("/a/b/"), DUAL_ASYNC))); + } + + /** + * @throws Exception If failed. + */ + public void testCanContain() throws Exception { + for (IgfsMode m: IgfsMode.values()) { + // Each mode can contain itself: + assertTrue(IgfsUtils.canContain(m, m)); + + // PRIMARY and PROXY can contain itself only: + assertTrue(IgfsUtils.canContain(PRIMARY,m) == (m == PRIMARY)); + assertTrue(IgfsUtils.canContain(PROXY,m) == (m == PROXY)); + + // Any mode but PRIMARY & PROXY can contain any mode: + if (m != PRIMARY && m != PROXY) + for (IgfsMode n: IgfsMode.values()) + assertTrue(IgfsUtils.canContain(m,n)); + } } /** * @throws Exception If failed. */ public void testResolve() throws Exception { - assertEquals(DUAL_SYNC, resolver.resolveMode(new IgfsPath("/"))); - assertEquals(DUAL_SYNC, resolver.resolveMode(new IgfsPath("/a"))); - assertEquals(DUAL_SYNC, resolver.resolveMode(new IgfsPath("/a/1"))); - assertEquals(PRIMARY, resolver.resolveMode(new IgfsPath("/a/b"))); - assertEquals(PRIMARY, resolver.resolveMode(new IgfsPath("/a/b/c"))); - assertEquals(PRIMARY, resolver.resolveMode(new IgfsPath("/a/b/c/2"))); - assertEquals(PROXY, resolver.resolveMode(new IgfsPath("/a/b/c/d"))); - assertEquals(PROXY, resolver.resolveMode(new IgfsPath("/a/b/c/d/e"))); + assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/"))); + assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/a"))); + assertEquals(DUAL_SYNC, reslvr.resolveMode(new IgfsPath("/a/1"))); + + assertEquals(PRIMARY, reslvr.resolveMode(new IgfsPath("/a/P"))); + assertEquals(PRIMARY, reslvr.resolveMode(new IgfsPath("/a/P/c"))); + assertEquals(PRIMARY, reslvr.resolveMode(new IgfsPath("/a/P/c/2"))); + + assertEquals(DUAL_ASYNC, reslvr.resolveMode(new IgfsPath("/a/b/"))); + assertEquals(DUAL_ASYNC, reslvr.resolveMode(new IgfsPath("/a/b/3"))); + assertEquals(DUAL_ASYNC, reslvr.resolveMode(new IgfsPath("/a/b/3/4"))); + + assertEquals(PROXY, reslvr.resolveMode(new IgfsPath("/a/b/c/d"))); + assertEquals(PROXY, reslvr.resolveMode(new IgfsPath("/a/b/c/d/5"))); + assertEquals(PROXY, reslvr.resolveMode(new IgfsPath("/a/b/c/d/6"))); } /** * @throws Exception If failed. */ - public void testResolveChildren() throws Exception { - assertEquals(new HashSet<IgfsMode>(){{add(DUAL_SYNC); add(PRIMARY); add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/"))); - assertEquals(new HashSet<IgfsMode>(){{add(DUAL_SYNC); add(PRIMARY); add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a"))); - assertEquals(new HashSet<IgfsMode>(){{add(DUAL_SYNC);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/1"))); - assertEquals(new HashSet<IgfsMode>(){{add(PRIMARY); add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/b"))); - assertEquals(new HashSet<IgfsMode>(){{add(PRIMARY); add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/b/c"))); - assertEquals(new HashSet<IgfsMode>(){{add(PRIMARY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/b/c/2"))); - assertEquals(new HashSet<IgfsMode>(){{add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/b/c/d"))); - assertEquals(new HashSet<IgfsMode>(){{add(PROXY);}}, - resolver.resolveChildrenModes(new IgfsPath("/a/b/c/d/e"))); + public void testModesValidation() throws Exception { + // Another mode inside PRIMARY directory: + try { + IgfsUtils.preparePathModes(DUAL_SYNC, Arrays.asList( + new T2<>(new IgfsPath("/a/"), PRIMARY), + new T2<>(new IgfsPath("/a/b/"), DUAL_ASYNC))); + + fail("IgniteCheckedException expected"); + } + catch (IgniteCheckedException ice) { + // Expected. + } + + // PRIMARY default mode and non-primary subfolder: + for (IgfsMode m: IgfsMode.values()) { + if (m != IgfsMode.PRIMARY) { + try { + IgfsUtils.preparePathModes(PRIMARY, Arrays.asList(new T2<>(new IgfsPath("/a/"), DUAL_ASYNC))); + + fail("IgniteCheckedException expected"); + } + catch (IgniteCheckedException ice) { + // Expected. + } + } + } + + // Duplicated sub-folders should be ignored: + List<T2<IgfsPath, IgfsMode>> modes = IgfsUtils.preparePathModes(DUAL_SYNC, Arrays.asList( + new T2<>(new IgfsPath("/a"), PRIMARY), + new T2<>(new IgfsPath("/c/d/"), PRIMARY), + new T2<>(new IgfsPath("/c/d/e/f"), PRIMARY) + )); + assertNotNull(modes); + assertEquals(2, modes.size()); + assertEquals(modes, Arrays.asList( + new T2<>(new IgfsPath("/c/d/"), PRIMARY), + new T2<>(new IgfsPath("/a"), PRIMARY) + )); + + // Non-duplicated sub-folders should not be ignored: + modes = IgfsUtils.preparePathModes(DUAL_SYNC, Arrays.asList( + new T2<>(new IgfsPath("/a/b"), DUAL_ASYNC), + new T2<>(new IgfsPath("/a/b/c"), DUAL_SYNC), + new T2<>(new IgfsPath("/a/b/c/d"), DUAL_ASYNC) + )); + assertNotNull(modes); + assertEquals(modes.size(), 3); + assertEquals(modes, Arrays.asList( + new T2<>(new IgfsPath("/a/b/c/d"), DUAL_ASYNC), + new T2<>(new IgfsPath("/a/b/c"), DUAL_SYNC), + new T2<>(new IgfsPath("/a/b"), DUAL_ASYNC) + )); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/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 1e54f8c..a6b7502 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 @@ -250,7 +250,7 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { public void testDefaultFoldersNonPrimary() throws Exception { setSecondaryFs = true; - mode = PRIMARY; + mode = DUAL_ASYNC; startUp(); @@ -258,43 +258,45 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { checkMode("/ignite/proxy/", PROXY); checkMode("/ignite/proxy/subfolder", PROXY); checkMode("/ignite/proxy/folder/file.txt", PROXY); - checkMode("/ignite/proxyx", PRIMARY); - checkMode("/ignite/proxyx/", PRIMARY); - checkMode("/ignite/proxyx/subfolder", PRIMARY); - checkMode("/ignite/proxyx/folder/file.txt", PRIMARY); + checkMode("/ignite/proxyx", mode); + checkMode("/ignite/proxyx/", mode); + checkMode("/ignite/proxyx/subfolder", mode); + checkMode("/ignite/proxyx/folder/file.txt", mode); - checkMode("/userdir/ignite/proxy", PRIMARY); - checkMode("/userdir/ignite/proxy/", PRIMARY); - checkMode("/userdir/ignite/proxy/subfolder", PRIMARY); - checkMode("/userdir/ignite/proxy/folder/file.txt", PRIMARY); + checkMode("/userdir/ignite/proxy", mode); + checkMode("/userdir/ignite/proxy/", mode); + checkMode("/userdir/ignite/proxy/subfolder", mode); + checkMode("/userdir/ignite/proxy/folder/file.txt", mode); checkMode("/ignite/sync", DUAL_SYNC); checkMode("/ignite/sync/", DUAL_SYNC); checkMode("/ignite/sync/subfolder", DUAL_SYNC); checkMode("/ignite/sync/folder/file.txt", DUAL_SYNC); - checkMode("/ignite/syncx", PRIMARY); - checkMode("/ignite/syncx/", PRIMARY); - checkMode("/ignite/syncx/subfolder", PRIMARY); - checkMode("/ignite/syncx/folder/file.txt", PRIMARY); - checkMode("/userdir/ignite/sync", PRIMARY); - checkMode("/userdir/ignite/sync/", PRIMARY); - checkMode("/userdir/ignite/sync/subfolder", PRIMARY); - checkMode("/userdir/ignite/sync/folder/file.txt", PRIMARY); + checkMode("/ignite/syncx", mode); + checkMode("/ignite/syncx/", mode); + checkMode("/ignite/syncx/subfolder", mode); + checkMode("/ignite/syncx/folder/file.txt", mode); + + checkMode("/userdir/ignite/sync", mode); + checkMode("/userdir/ignite/sync/", mode); + checkMode("/userdir/ignite/sync/subfolder", mode); + checkMode("/userdir/ignite/sync/folder/file.txt", mode); checkMode("/ignite/async", DUAL_ASYNC); checkMode("/ignite/async/", DUAL_ASYNC); checkMode("/ignite/async/subfolder", DUAL_ASYNC); checkMode("/ignite/async/folder/file.txt", DUAL_ASYNC); - checkMode("/ignite/asyncx", PRIMARY); - checkMode("/ignite/asyncx/", PRIMARY); - checkMode("/ignite/asyncx/subfolder", PRIMARY); - checkMode("/ignite/asyncx/folder/file.txt", PRIMARY); - - checkMode("/userdir/ignite/async", PRIMARY); - checkMode("/userdir/ignite/async/", PRIMARY); - checkMode("/userdir/ignite/async/subfolder", PRIMARY); - checkMode("/userdir/ignite/async/folder/file.txt", PRIMARY); + + checkMode("/ignite/asyncx", mode); + checkMode("/ignite/asyncx/", mode); + checkMode("/ignite/asyncx/subfolder", mode); + checkMode("/ignite/asyncx/folder/file.txt", mode); + + checkMode("/userdir/ignite/async", mode); + checkMode("/userdir/ignite/async/", mode); + checkMode("/userdir/ignite/async/subfolder", mode); + checkMode("/userdir/ignite/async/folder/file.txt", mode); } /** @@ -333,8 +335,11 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest { mode = DUAL_ASYNC; - pathModes(F.t("/ignite/primary", PROXY), F.t("/ignite/proxy", DUAL_SYNC), - F.t("/ignite/sync", DUAL_ASYNC), F.t("/ignite/async", PRIMARY)); + pathModes( + F.t("/ignite/primary", PROXY), + F.t("/ignite/proxy", DUAL_SYNC), + F.t("/ignite/sync", DUAL_ASYNC), + F.t("/ignite/async", PRIMARY)); startUp(); http://git-wip-us.apache.org/repos/asf/ignite/blob/44d67844/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java index 66255c9..cc02d05 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java @@ -80,7 +80,6 @@ import java.util.Collection; import java.util.EnumSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import static org.apache.ignite.configuration.FileSystemConfiguration.DFLT_IGFS_LOG_BATCH_SIZE; @@ -653,21 +652,16 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea try { IgfsPath srcPath = convert(src); IgfsPath dstPath = convert(dst); - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(srcPath); - if (childrenModes.contains(PROXY)) { - if (clientLog.isLogEnabled()) - clientLog.logRename(srcPath, PROXY, dstPath); + IgfsMode srcMode = modeRslvr.resolveMode(srcPath); - secondaryFileSystem().rename(toSecondary(src), toSecondary(dst)); - } - else { - if (clientLog.isLogEnabled()) - clientLog.logRename(srcPath, modeRslvr.resolveMode(srcPath), dstPath); + if (clientLog.isLogEnabled()) + clientLog.logRename(srcPath, srcMode, dstPath); + if (srcMode == PROXY) + secondaryFileSystem().rename(toSecondary(src), toSecondary(dst)); + else rmtClient.rename(srcPath, dstPath); - } - } finally { leaveBusy(); @@ -682,10 +676,10 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea try { IgfsPath path = convert(f); + IgfsMode mode = modeRslvr.resolveMode(path); - Set<IgfsMode> childrenModes = modeRslvr.resolveChildrenModes(path); - if (childrenModes.contains(PROXY)) { + if (mode == PROXY) { if (clientLog.isLogEnabled()) clientLog.logDelete(path, PROXY, recursive);
