You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/09/26 12:13:17 UTC

[03/50] ignite git commit: IGNITE-3333: IGFS: Now it is possible to use ATOMIC cache for data blocks when fragmentizer it disabled. This closes #1108.

IGNITE-3333: IGFS: Now it is possible to use ATOMIC cache for data blocks when fragmentizer it disabled. This closes #1108.


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

Branch: refs/heads/master
Commit: 548fe6a3fe4d38caebe3b45366f3e812b035d006
Parents: 38d1d04
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Sep 26 12:05:07 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 26 12:05:07 2016 +0300

----------------------------------------------------------------------
 .../configuration/FileSystemConfiguration.java  |  2 +-
 .../processors/igfs/IgfsDataManager.java        |  2 +-
 .../internal/processors/igfs/IgfsProcessor.java | 17 ++++++++-
 .../igfs/IgfsAbstractBaseSelfTest.java          |  8 ++++
 .../IgfsAtomicPrimaryMultiNodeSelfTest.java     | 39 ++++++++++++++++++++
 .../IgfsAtomicPrimaryOffheapTieredSelfTest.java | 39 ++++++++++++++++++++
 .../IgfsAtomicPrimaryOffheapValuesSelfTest.java | 39 ++++++++++++++++++++
 .../igfs/IgfsAtomicPrimarySelfTest.java         | 39 ++++++++++++++++++++
 .../ignite/testsuites/IgniteIgfsTestSuite.java  | 10 ++++-
 9 files changed, 190 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/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 6e0e5e7..e665e84 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
@@ -879,7 +879,7 @@ public class FileSystemConfiguration {
      * <p>
      * IGFS stores information about file system structure (metadata) inside a transactional cache configured through
      * {@link #getMetaCacheName()} property. Metadata updates caused by operations on IGFS usually require several
-     * intearnal keys to be updated. As IGFS metadata cache usually operates in {@link CacheMode#REPLICATED} mode,
+     * internal keys to be updated. As IGFS metadata cache usually operates in {@link CacheMode#REPLICATED} mode,
      * meaning that all nodes have all metadata locally, it makes sense to give a hint to Ignite to co-locate
      * ownership of all metadata keys on a single node. This will decrease amount of network trips required to update
      * metadata and hence could improve performance.

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index 2f704ae..e534800 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -609,7 +609,7 @@ public class IgfsDataManager extends IgfsManager {
     }
 
     /**
-     * Moves all colocated blocks in range to non-colocated keys.
+     * Moves all collocated blocks in range to non-colocated keys.
      * @param fileInfo File info to move data for.
      * @param range Range to move.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 85dcb1c..5c0e030 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -311,8 +311,9 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
             if (GridQueryProcessor.isEnabled(dataCacheCfg))
                 throw new IgniteCheckedException("IGFS data cache cannot start with enabled query indexing.");
 
-            if (dataCacheCfg.getAtomicityMode() != TRANSACTIONAL)
-                throw new IgniteCheckedException("Data cache should be transactional: " + cfg.getDataCacheName());
+            if (dataCacheCfg.getAtomicityMode() != TRANSACTIONAL && cfg.isFragmentizerEnabled())
+                throw new IgniteCheckedException("Data cache should be transactional: " + cfg.getDataCacheName() +
+                    " when fragmentizer is enabled");
 
             if (metaCacheCfg == null)
                 throw new IgniteCheckedException("Metadata cache is not configured locally for IGFS: " + cfg);
@@ -442,6 +443,18 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
             }
     }
 
+    /**
+     * Check IGFS property equality on local and remote nodes.
+     *
+     * @param name Property human readable name.
+     * @param propName Property name/
+     * @param rmtNodeId Remote node ID.
+     * @param rmtVal Remote value.
+     * @param locVal Local value.
+     * @param igfsName IGFS name.
+     *
+     * @throws IgniteCheckedException If failed.
+     */
     private void checkSame(String name, String propName, UUID rmtNodeId, Object rmtVal, Object locVal, String igfsName)
         throws IgniteCheckedException {
         if (!F.eq(rmtVal, locVal))

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/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 58c4c50..79dc57b 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
@@ -220,6 +220,13 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
+     * @return FragmentizerEnabled IGFS config flag.
+     */
+    protected boolean fragmentizerEnabled() {
+        return true;
+    }
+
+    /**
      * @return Relaxed consistency flag.
      */
     protected boolean initializeDefaultPathModes() {
@@ -378,6 +385,7 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS);
         igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH);
         igfsCfg.setRelaxedConsistency(relaxedConsistency());
+        igfsCfg.setFragmentizerEnabled(fragmentizerEnabled());
 
         igfsCfg.setInitializeDefaultPathModes(initializeDefaultPathModes());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryMultiNodeSelfTest.java
new file mode 100644
index 0000000..0e342a9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryMultiNodeSelfTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Tests for PRIMARY mode.
+ */
+public class IgfsAtomicPrimaryMultiNodeSelfTest extends IgfsPrimaryMultiNodeSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean fragmentizerEnabled() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg,
+        CacheConfiguration metaCacheCfg) {
+        super.prepareCacheConfigurations(dataCacheCfg, metaCacheCfg);
+
+        dataCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapTieredSelfTest.java
new file mode 100644
index 0000000..09b4f9e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapTieredSelfTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Tests for PRIMARY mode.
+ */
+public class IgfsAtomicPrimaryOffheapTieredSelfTest extends IgfsPrimaryOffheapTieredSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean fragmentizerEnabled() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg,
+        CacheConfiguration metaCacheCfg) {
+        super.prepareCacheConfigurations(dataCacheCfg, metaCacheCfg);
+
+        dataCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapValuesSelfTest.java
new file mode 100644
index 0000000..8e9965d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimaryOffheapValuesSelfTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Tests for PRIMARY mode.
+ */
+public class IgfsAtomicPrimaryOffheapValuesSelfTest extends IgfsPrimaryOffheapValuesSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean fragmentizerEnabled() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg,
+        CacheConfiguration metaCacheCfg) {
+        super.prepareCacheConfigurations(dataCacheCfg, metaCacheCfg);
+
+        dataCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimarySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimarySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimarySelfTest.java
new file mode 100644
index 0000000..1c28d6b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAtomicPrimarySelfTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Tests for PRIMARY mode.
+ */
+public class IgfsAtomicPrimarySelfTest extends IgfsPrimarySelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean fragmentizerEnabled() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void prepareCacheConfigurations(CacheConfiguration dataCacheCfg,
+        CacheConfiguration metaCacheCfg) {
+        super.prepareCacheConfigurations(dataCacheCfg, metaCacheCfg);
+
+        dataCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/548fe6a3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index 5a7e3d7..775c2ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -20,6 +20,10 @@ package org.apache.ignite.testsuites;
 import junit.framework.TestSuite;
 import org.apache.ignite.igfs.IgfsFragmentizerSelfTest;
 import org.apache.ignite.igfs.IgfsFragmentizerTopologySelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsAtomicPrimaryMultiNodeSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsAtomicPrimaryOffheapTieredSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsAtomicPrimaryOffheapValuesSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsAtomicPrimarySelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsAttributesSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualAsyncSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualSyncSelfTest;
@@ -154,11 +158,15 @@ public class IgniteIgfsTestSuite extends TestSuite {
 
         suite.addTestSuite(IgfsMaxSizeSelfTest.class);
 
-
         suite.addTestSuite(IgfsProxySelfTest.class);
         suite.addTestSuite(IgfsLocalSecondaryFileSystemProxySelfTest.class);
         suite.addTestSuite(IgfsLocalSecondaryFileSystemProxyClientSelfTest.class);
 
+        suite.addTestSuite(IgfsAtomicPrimarySelfTest.class);
+        suite.addTestSuite(IgfsAtomicPrimaryMultiNodeSelfTest.class);
+        suite.addTestSuite(IgfsAtomicPrimaryOffheapTieredSelfTest.class);
+        suite.addTestSuite(IgfsAtomicPrimaryOffheapValuesSelfTest.class);
+
         return suite;
     }
 }
\ No newline at end of file