Repository: ignite
Updated Branches:
  refs/heads/ignite-5901 96ec4cacf -> fa2b743b2


IGNITE-5901 - Debug


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

Branch: refs/heads/ignite-5901
Commit: fa2b743b209396fa9c39d3624304eb21612e321b
Parents: 96ec4ca
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Thu Aug 10 19:05:02 2017 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Thu Aug 10 19:05:02 2017 +0300

----------------------------------------------------------------------
 .../wal/FileWriteAheadLogManager.java            | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fa2b743b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 17db8f8..da295aa 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -24,6 +24,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
+import java.nio.channels.AsynchronousCloseException;
 import java.nio.file.Files;
 import java.sql.Time;
 import java.util.Arrays;
@@ -69,6 +70,7 @@ import 
org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -1675,6 +1677,9 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
          */
         private final Condition nextSegment = lock.newCondition();
 
+        /** */
+        private volatile Exception closeStack;
+
         /**
          * @param fileIO I/O file interface to use
          * @param idx Absolute WAL segment file index for easy access.
@@ -2034,6 +2039,10 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
                         fileIO.force();
                     }
                     catch (IOException e) {
+                        if (X.hasCause(e, AsynchronousCloseException.class)) {
+                            log.error("Was concurrently closed: ", closeStack);
+                        }
+
                         throw new StorageException(e);
                     }
 
@@ -2062,7 +2071,9 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
             if (stop.compareAndSet(false, true)) {
                 flushOrWait(null, true);
 
-                assert stopped() : "Segment is not closed after close flush: " 
+ head.get();
+                WALRecord hd = head.get();
+
+                assert stopped() : "Segment is not closed after close flush: " 
+ hd;
 
                 try {
                     int switchSegmentRecSize = 
RecordV1Serializer.REC_TYPE_SIZE + RecordV1Serializer.FILE_WAL_POINTER_SIZE;
@@ -2095,6 +2106,8 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
                         lastFsyncPos = written;
                     }
 
+                    closeStack = new Exception("written=" + written + ", 
head=" + hd);
+
                     fileIO.close();
                 }
                 catch (IOException e) {
@@ -2222,6 +2235,10 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
                     assert written == fileIO.position();
                 }
                 catch (IOException e) {
+                    if (X.hasCause(e, AsynchronousCloseException.class)) {
+                        log.error("Was concurrently closed: ", closeStack);
+                    }
+
                     invalidateEnvironmentLocked(e);
 
                     throw new StorageException(e);

Reply via email to