ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [3/3] ignite git commit: IGNITE-3353: IGFS: Fixed "out-of-space" handling.
Date Wed, 22 Jun 2016 13:17:23 GMT
IGNITE-3353: IGFS: Fixed "out-of-space" handling.


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

Branch: refs/heads/ignite-3353
Commit: ceac6ee0b1bbaca6d763d0f5812ce38d5d8a18b7
Parents: 05b3a0a
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Jun 22 16:16:49 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Jun 22 16:16:49 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheAdapter.java | 16 +++-------------
 .../internal/processors/igfs/IgfsDataManager.java   | 14 ++------------
 .../processors/igfs/IgfsOutputStreamImpl.java       | 10 ++++++++--
 .../processors/igfs/IgfsDataManagerSelfTest.java    |  6 +++---
 4 files changed, 16 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ceac6ee0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index b4daec2..1a55fe3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -344,19 +344,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
                         igfsDataSpaceMax = igfsCfg.getMaxSpaceSize();
 
-                        if (igfsDataSpaceMax == 0) {
-                            long maxMem = Runtime.getRuntime().maxMemory();
-
-                            // We leave JVM at least 500M of memory for correct operation.
-                            long jvmFreeSize = (maxMem - 512 * 1024 * 1024);
-
-                            if (jvmFreeSize <= 0)
-                                jvmFreeSize = maxMem / 2;
-
-                            long dfltMaxSize = (long)(0.8f * maxMem);
-
-                            igfsDataSpaceMax = Math.min(dfltMaxSize, jvmFreeSize);
-                        }
+                        // Do we have limits?
+                        if (igfsDataSpaceMax <= 0)
+                            igfsDataSpaceMax = Long.MAX_VALUE;
                     }
 
                     break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/ceac6ee0/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 cb2b630..bdf3b08 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
@@ -465,23 +465,13 @@ public class IgfsDataManager extends IgfsManager {
      * Notifies data manager that no further writes will be performed on stream.
      *
      * @param fileId File ID.
-     * @param await Await completion.
      * @throws IgniteCheckedException If failed.
      */
-    public void writeClose(IgniteUuid fileId, boolean await) throws IgniteCheckedException
{
+    public void writeClose(IgniteUuid fileId) throws IgniteCheckedException {
         WriteCompletionFuture fut = pendingWrites.get(fileId);
 
-        if (fut != null) {
+        if (fut != null)
             fut.markWaitingLastAck();
-
-            if (await)
-                fut.get();
-        }
-        else {
-            if (log.isDebugEnabled())
-                log.debug("Failed to find write completion future for file in pending write
map (most likely it was " +
-                    "failed): " + fileId);
-        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/ceac6ee0/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
index 7741a25..f6b1104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
@@ -23,6 +23,7 @@ import org.apache.ignite.igfs.IgfsException;
 import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsOutputStream;
 import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -64,6 +65,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
     /** Mutex for synchronization. */
     private final Object mux = new Object();
 
+    /** Write completion future. */
+    private final IgniteInternalFuture<Boolean> writeFut;
+
     /** Flag for this stream open/closed state. */
     private boolean closed;
 
@@ -120,7 +124,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
 
             streamRange = initialStreamRange(fileInfo);
 
-            igfsCtx.data().writeStart(fileInfo.id());
+            writeFut = igfsCtx.data().writeStart(fileInfo.id());
         }
 
         igfsCtx.igfs().localMetrics().incrementFilesOpenedForWrite();
@@ -300,7 +304,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
 
                 flushRemainder();
 
-                igfsCtx.data().writeClose(fileInfo.id(), true);
+                igfsCtx.data().writeClose(fileInfo.id());
+
+                writeFut.get();
 
                 flushSuccess = true;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ceac6ee0/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 0d1a66f..70d6b99 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
@@ -195,7 +195,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
 
             assert remainder == null;
 
-            mgr.writeClose(info.id(), false);
+            mgr.writeClose(info.id());
 
             fut.get(3000);
 
@@ -287,7 +287,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
 
             assert left2 == null;
 
-            mgr.writeClose(info.id(), false);
+            mgr.writeClose(info.id());
 
             fut.get(3000);
 
@@ -369,7 +369,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
                 assert left == null : "No remainder should be returned if flush is true:
" + Arrays.toString(left);
             }
 
-            mgr.writeClose(info.id(), false);
+            mgr.writeClose(info.id());
 
             assertTrue(range.regionEqual(new IgfsFileAffinityRange(0, writesCnt * chunkSize
- 1, null)));
 


Mime
View raw message