You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/04/19 09:54:41 UTC

[1/2] ignite git commit: IGNITE-3523 IGFS: Remove "initialize default path modes" feature. This closes #1786.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2.0 d38348432 -> 2ded758ad


IGNITE-3523 IGFS: Remove "initialize default path modes" feature. This closes #1786.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/22d5e55b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/22d5e55b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/22d5e55b

Branch: refs/heads/ignite-2.0
Commit: 22d5e55bee69403c4f9f8da9c113751ce110aa2d
Parents: 36e7e19
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Apr 19 12:54:14 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 19 12:54:14 2017 +0300

----------------------------------------------------------------------
 .../configuration/FileSystemConfiguration.java  |  54 +-------
 .../internal/processors/igfs/IgfsImpl.java      |  22 +---
 .../igfs/IgfsAbstractBaseSelfTest.java          |   9 --
 .../igfs/IgfsDualAbstractSelfTest.java          |  33 -----
 .../processors/igfs/IgfsModesSelfTest.java      | 130 -------------------
 .../igfs/HadoopFIleSystemFactorySelfTest.java   |  12 +-
 6 files changed, 14 insertions(+), 246 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 337506c..d667fe8 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -76,9 +76,6 @@ public class FileSystemConfiguration {
     /** Default IPC endpoint enabled flag. */
     public static final boolean DFLT_IPC_ENDPOINT_ENABLED = true;
 
-    /** Default value of whether to initialize default path modes. */
-    public static final boolean DFLT_INIT_DFLT_PATH_MODES = false;
-
     /** Default value of metadata co-location flag. */
     public static final boolean DFLT_COLOCATE_META = true;
 
@@ -145,9 +142,6 @@ public class FileSystemConfiguration {
     /** Maximum range length. */
     private long maxTaskRangeLen;
 
-    /** Whether to initialize default path modes. */
-    private boolean initDfltPathModes = DFLT_INIT_DFLT_PATH_MODES;
-
     /** Metadata co-location flag. */
     private boolean colocateMeta = DFLT_COLOCATE_META;
 
@@ -191,7 +185,6 @@ public class FileSystemConfiguration {
         fragmentizerThrottlingBlockLen = cfg.getFragmentizerThrottlingBlockLength();
         fragmentizerThrottlingDelay = cfg.getFragmentizerThrottlingDelay();
         secondaryFs = cfg.getSecondaryFileSystem();
-        initDfltPathModes = cfg.isInitializeDefaultPathModes();
         ipcEndpointCfg = cfg.getIpcEndpointConfiguration();
         ipcEndpointEnabled = cfg.isIpcEndpointEnabled();
         maxSpace = cfg.getMaxSpaceSize();
@@ -579,15 +572,6 @@ public class FileSystemConfiguration {
      * <p>
      * If path doesn't correspond to any specified prefix or mappings are not provided, then
      * {@link #getDefaultMode()} is used.
-     * <p>
-     * If {@link #isInitializeDefaultPathModes()} is set to {@code true}, the following path modes will be created
-     * by default:
-     * <li>{@code /ignite/primary} and all it's sub-folders will always work in {@code PRIMARY} mode.</li>
-     * <p>
-     * And in case secondary file system URI is provided:
-     * <li>{@code /ignite/proxy} and all it's sub-folders will always work in {@code PROXY} mode.</li>
-     * <li>{@code /ignite/sync} and all it's sub-folders will always work in {@code DUAL_SYNC} mode.</li>
-     * <li>{@code /ignite/async} and all it's sub-folders will always work in {@code DUAL_ASYNC} mode.</li>
      *
      * @return Map of paths to {@code IGFS} modes.
      */
@@ -644,6 +628,7 @@ public class FileSystemConfiguration {
      * Sets delay in milliseconds for which fragmentizer is paused.
      *
      * @param fragmentizerThrottlingDelay Delay in milliseconds.
+     * @return {@code this} for chaining.
      */
     public FileSystemConfiguration setFragmentizerThrottlingDelay(long fragmentizerThrottlingDelay) {
         this.fragmentizerThrottlingDelay = fragmentizerThrottlingDelay;
@@ -759,43 +744,6 @@ public class FileSystemConfiguration {
     }
 
     /**
-     * Get whether to initialize default path modes.
-     * <p>
-     * When set to {@code true} Ignite will automatically create the following path modes:
-     * <ul>
-     *     <li>{@code /ignite/primary} - will work in {@link IgfsMode#PRIMARY} mode;</li>
-     *     <li>{@code /ignite/sync} - will work in {@link IgfsMode#DUAL_SYNC} mode (only if secondary file system
-     *         is set);</li>
-     *     <li>{@code /ignite/async} - will work in {@link IgfsMode#DUAL_ASYNC} mode (only if secondary file system
-     *         is set);</li>
-     *     <li>{@code /ignite/proxy} - will work in {@link IgfsMode#PROXY} mode (only if secondary file system
-     *         is set).</li>
-     * </ul>
-     * See {@link #getPathModes()} for more information about path modes.
-     * <p>
-     * Defaults to {@link #DFLT_INIT_DFLT_PATH_MODES}.
-     *
-     * @return {@code True} if default path modes will be initialized.
-     */
-    public boolean isInitializeDefaultPathModes() {
-        return initDfltPathModes;
-    }
-
-    /**
-     * Set whether to initialize default path modes.
-     * <p>
-     * See {@link #isInitializeDefaultPathModes()} for more information.
-     *
-     * @param initDfltPathModes Whether to initialize default path modes.
-     * @return {@code this} for chaining.
-     */
-    public FileSystemConfiguration setInitializeDefaultPathModes(boolean initDfltPathModes) {
-        this.initDfltPathModes = initDfltPathModes;
-
-        return this;
-    }
-
-    /**
      * Get whether to co-locate metadata on a single node.
      * <p>
      * Normally Ignite spread ownership of particular keys among all cache nodes. Transaction with keys owned by

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/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 1c0fbc2..6a7400c 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
@@ -199,28 +199,10 @@ public final class IgfsImpl implements IgfsEx {
             dfltMode = cfg.getDefaultMode();
 
         Map<String, IgfsMode> cfgModes = new LinkedHashMap<>();
-        Map<String, IgfsMode> dfltModes = new LinkedHashMap<>(4, 1.0f);
-
-        if (cfg.isInitializeDefaultPathModes() && IgfsUtils.isDualMode(dfltMode)) {
-            dfltModes.put("/ignite/primary", PRIMARY);
-
-            if (secondaryFs != null) {
-                dfltModes.put("/ignite/proxy", PROXY);
-                dfltModes.put("/ignite/sync", DUAL_SYNC);
-                dfltModes.put("/ignite/async", DUAL_ASYNC);
-            }
-        }
-
-        cfgModes.putAll(dfltModes);
 
         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
-                    U.warn(log, "Ignoring path mode because it conflicts with Ignite reserved path " +
-                        "(use another path) [mode=" + e.getValue() + ", path=" + e.getKey() + ']');
-            }
+            for (Map.Entry<String, IgfsMode> e : cfg.getPathModes().entrySet())
+                cfgModes.put(e.getKey(), e.getValue());
         }
 
         ArrayList<T2<IgfsPath, IgfsMode>> modes = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
index 47a768e..d215815 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
@@ -211,13 +211,6 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
-     * @return Relaxed consistency flag.
-     */
-    protected boolean initializeDefaultPathModes() {
-        return false;
-    }
-
-    /**
      * @return Client flag.
      */
     protected boolean client() {
@@ -369,8 +362,6 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setRelaxedConsistency(relaxedConsistency());
         igfsCfg.setFragmentizerEnabled(fragmentizerEnabled());
 
-        igfsCfg.setInitializeDefaultPathModes(initializeDefaultPathModes());
-
         CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
 
         dataCacheCfg.setNearConfiguration(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/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 7b83cfc..12f46da 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
@@ -51,39 +51,6 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         super(mode);
     }
 
-    /** {@inheritDoc} */
-    @Override protected boolean initializeDefaultPathModes() {
-        // Enable default modes in order to test various modes.
-        return true;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDefaultDirectories() throws Exception {
-        IgfsPath gg = new IgfsPath("/ignite");
-        IgfsPath[] paths = paths(
-            gg, new IgfsPath(gg, "sync"), new IgfsPath(gg, "async"), new IgfsPath(gg, "primary"));
-
-        create(igfs, paths, null);
-
-        for (IgfsPath p : paths)
-            assert igfs.exists(p);
-
-        assert igfs.modeResolver().resolveMode(gg) == mode;
-
-        if (mode != PROXY) {
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "sync")) == IgfsMode.DUAL_SYNC;
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "async")) == IgfsMode.DUAL_ASYNC;
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "primary")) == IgfsMode.PRIMARY;
-            assert !igfsSecondary.exists("/ignite/primary"); // PRIMARY mode path must exist in upper level fs only.
-        }
-
-        // All the child paths of "/ignite/" must be visible in listings:
-        assert igfs.listFiles(gg).size() == 3;
-        assert igfs.listPaths(gg).size() == 3;
-    }
-
     /**
      * Test existence check when the path exists only remotely.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/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 40ac0e1..0720d55 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
@@ -100,7 +100,6 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest {
 
         igfsCfg.setName("igfs");
         igfsCfg.setBlockSize(512 * 1024);
-        igfsCfg.setInitializeDefaultPathModes(true);
 
         if (setNullMode)
             igfsCfg.setDefaultMode(null);
@@ -217,135 +216,6 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
-     * Test predefined path modes for PRIMARY mode.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersPrimary() throws Exception {
-        setSecondaryFs = true;
-
-        mode = DUAL_ASYNC;
-
-        startUp();
-
-        checkMode("/ignite/primary", PRIMARY);
-        checkMode("/ignite/primary/", PRIMARY);
-        checkMode("/ignite/primary/subfolder", PRIMARY);
-        checkMode("/ignite/primary/folder/file.txt", PRIMARY);
-        checkMode("/ignite/primaryx", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/subfolder", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/folder/file.txt", DUAL_ASYNC);
-    }
-
-    /**
-     * Test predefined path modes for all modes except of PRIMARY mode.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersNonPrimary() throws Exception {
-        setSecondaryFs = true;
-
-        mode = DUAL_ASYNC;
-
-        startUp();
-
-        checkMode("/ignite/proxy", PROXY);
-        checkMode("/ignite/proxy/", PROXY);
-        checkMode("/ignite/proxy/subfolder", PROXY);
-        checkMode("/ignite/proxy/folder/file.txt", PROXY);
-        checkMode("/ignite/proxyx", mode);
-        checkMode("/ignite/proxyx/", mode);
-        checkMode("/ignite/proxyx/subfolder", mode);
-        checkMode("/ignite/proxyx/folder/file.txt", mode);
-
-        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", 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", 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);
-    }
-
-    /**
-     * Ensure that in case secondary file system URI is not provided, all predefined have no special mappings. This test
-     * doesn't make sense for PRIMARY mode since in case URI is not provided DUAL_* modes automatically transforms to
-     * PRIMARY and for PROXY mode we will have an exception during startup.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultsNoSecondaryUriNonPrimary() throws Exception {
-        startUp();
-
-        checkMode("/ignite/proxy", PRIMARY);
-        checkMode("/ignite/proxy/", PRIMARY);
-        checkMode("/ignite/proxy/subfolder", PRIMARY);
-        checkMode("/ignite/proxy/folder/file.txt", PRIMARY);
-
-        checkMode("/ignite/sync", PRIMARY);
-        checkMode("/ignite/sync/", PRIMARY);
-        checkMode("/ignite/sync/subfolder", PRIMARY);
-        checkMode("/ignite/sync/folder/file.txt", PRIMARY);
-
-        checkMode("/ignite/async", PRIMARY);
-        checkMode("/ignite/async/", PRIMARY);
-        checkMode("/ignite/async/subfolder", PRIMARY);
-        checkMode("/ignite/async/folder/file.txt", PRIMARY);
-    }
-
-    /**
-     * Ensure that it is impossible to override mappings for /ignite/* folders.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersOverride() throws Exception {
-        setSecondaryFs = true;
-
-        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));
-
-        startUp();
-
-        checkMode("/ignite/primary", PRIMARY);
-        checkMode("/ignite/proxy", PROXY);
-        checkMode("/ignite/sync", DUAL_SYNC);
-        checkMode("/ignite/async", DUAL_ASYNC);
-    }
-
-    /**
      * Ensure that DUAL_ASYNC mode is set by default.
      *
      * @throws Exception If failed.

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
index 1793a05..04ef263 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.hadoop.impl.igfs;
 
+import java.util.HashMap;
+import java.util.Map;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -224,7 +226,6 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setDefaultMode(dfltMode);
         igfsCfg.setIpcEndpointConfiguration(endpointCfg);
         igfsCfg.setSecondaryFileSystem(secondaryFs);
-        igfsCfg.setInitializeDefaultPathModes(true);
 
         CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
 
@@ -243,6 +244,15 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setDataCacheConfiguration(dataCacheCfg);
         igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
 
+        if (secondaryFs != null) {
+            Map<String, IgfsMode> modes = new HashMap<>();
+            modes.put("/ignite/sync/", IgfsMode.DUAL_SYNC);
+            modes.put("/ignite/async/", IgfsMode.DUAL_ASYNC);
+            modes.put("/ignite/proxy/", IgfsMode.PROXY);
+
+            igfsCfg.setPathModes(modes);
+        }
+
         IgniteConfiguration cfg = new IgniteConfiguration();
 
         cfg.setIgniteInstanceName(name);


[2/2] ignite git commit: Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0

Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ded758a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ded758a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ded758a

Branch: refs/heads/ignite-2.0
Commit: 2ded758ad1f1663aea05ca943ecf509b1574c0bf
Parents: 22d5e55 d383484
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 19 12:54:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 19 12:54:34 2017 +0300

----------------------------------------------------------------------
 .../junits/common/GridCommonAbstractTest.java   | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------