You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/09/12 11:19:09 UTC
[30/49] ignite git commit: IGNITE-3423 IGFS: Fixed incorrect result
of IgfsGlobalSpaceTask for IGFS of unlimited size. This closes #1032.
IGNITE-3423 IGFS: Fixed incorrect result of IgfsGlobalSpaceTask for IGFS of unlimited size. This closes #1032.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2703648f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2703648f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2703648f
Branch: refs/heads/ignite-comm-opts1
Commit: 2703648f380037a833e55a52a6c33e844a9e48fc
Parents: d672f29
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:12:34 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:12:34 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsDataManager.java | 2 +-
.../processors/igfs/IgfsMaxSizeSelfTest.java | 122 +++++++++++++++++++
.../ignite/testsuites/IgniteIgfsTestSuite.java | 3 +
3 files changed, 126 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/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 1397e4e..5e2c6b2 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
@@ -250,7 +250,7 @@ public class IgfsDataManager extends IgfsManager {
* @return Maximum number of bytes for IGFS data cache.
*/
public long maxSpaceSize() {
- return dataCachePrj.igfsDataSpaceMax();
+ return (igfsCtx.configuration().getMaxSpaceSize() <= 0) ? 0 : dataCachePrj.igfsDataSpaceMax();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
new file mode 100644
index 0000000..c376c52
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.FileSystemConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.internal.IgniteEx;
+
+/**
+ * Check max size limit.
+ */
+@SuppressWarnings("ConstantConditions")
+public class IgfsMaxSizeSelfTest extends IgfsCommonAbstractTest {
+ /** Work directory. */
+ private static long maxSize;
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
+
+ igfsCfg.setDataCacheName("dataCache");
+ igfsCfg.setMetaCacheName("metaCache");
+ igfsCfg.setName("test");
+
+ if (maxSize > 0)
+ igfsCfg.setMaxSpaceSize(maxSize);
+
+ CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
+
+ dataCacheCfg.setName("dataCache");
+ dataCacheCfg.setCacheMode(CacheMode.PARTITIONED);
+ dataCacheCfg.setNearConfiguration(null);
+ dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2));
+ dataCacheCfg.setBackups(0);
+ dataCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ dataCacheCfg.setOffHeapMaxMemory(0);
+
+ CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
+
+ metaCacheCfg.setName("metaCache");
+ metaCacheCfg.setNearConfiguration(null);
+ metaCacheCfg.setCacheMode(CacheMode.REPLICATED);
+ metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ metaCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+ cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
+ cfg.setFileSystemConfiguration(igfsCfg);
+ cfg.setGridName(gridName);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDefaultOrZero() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ try {
+ assertEquals(0, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNegative() throws Exception {
+ maxSize = -1;
+
+ IgniteEx ig = startGrid(0);
+
+ try {
+ assertEquals(0, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPositive() throws Exception {
+ maxSize = 1 << 20;
+
+ IgniteEx ig = startGrid(0);
+
+ try {
+ assertEquals(maxSize, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/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 44199d4..0241068 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
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsCachePerBlockLruEvictionPo
import org.apache.ignite.internal.processors.igfs.IgfsCacheSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsDualAsyncClientSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsDualSyncClientSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsMaxSizeSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryClientSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsDataManagerSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsDualAsyncSelfTest;
@@ -148,6 +149,8 @@ public class IgniteIgfsTestSuite extends TestSuite {
// TODO: Enable when IGFS failover is fixed.
//suite.addTestSuite(IgfsBackupFailoverSelfTest.class);
+ suite.addTestSuite(IgfsMaxSizeSelfTest.class);
+
return suite;
}
}
\ No newline at end of file