ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [21/21] ignite git commit: IGNITE-5816 - Optimized segment close
Date Thu, 27 Jul 2017 11:31:43 GMT
IGNITE-5816 - Optimized segment close


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

Branch: refs/heads/ignite-5816
Commit: bd92050867ddf609ce017bf51e4419f7bb7dc695
Parents: 208517a
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Thu Jul 27 14:30:30 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Jul 27 14:30:30 2017 +0300

----------------------------------------------------------------------
 .../persistence/wal/FileWriteAheadLogManager.java      | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bd920508/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 727f2df..b83aafb 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
@@ -2056,14 +2056,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
          * @throws StorageException If failed.
          */
         private boolean close(boolean rollOver) throws IgniteCheckedException, StorageException
{
-            if (mode == WALMode.DEFAULT)
-                fsync(null, true);
-            else
+            if (stop.compareAndSet(false, true)) {
                 flushOrWait(null, true);
 
-            assert stopped() : "Segment is not closed after close flush: " + head.get();
+                assert stopped() : "Segment is not closed after close flush: " + head.get();
 
-            if (stop.compareAndSet(false, true)) {
                 try {
                     int switchSegmentRecSize = RecordV1Serializer.REC_TYPE_SIZE + RecordV1Serializer.FILE_WAL_POINTER_SIZE;
 
@@ -2079,10 +2076,12 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
 
                         fileIO.write(buf, written);
 
-                        if (mode == WALMode.DEFAULT)
-                            fileIO.force();
                     }
 
+                    // Instead of two fsyncs.
+                    if (mode == WALMode.DEFAULT)
+                        fileIO.force();
+
                     fileIO.close();
                 }
                 catch (IOException e) {


Mime
View raw message