ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [08/50] [abbrv] ignite git commit: IGNITE-8282 Direct IO: support fdatasync, which does not flush modified metadata - Fixes #3833.
Date Mon, 23 Apr 2018 07:12:04 GMT
IGNITE-8282 Direct IO: support fdatasync, which does not flush modified metadata - Fixes #3833.

Signed-off-by: dpavlov <dpavlov@apache.org>


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

Branch: refs/heads/ignite-6083
Commit: 63dc75b85b12f1c7bea796714c1e88925c16b1ab
Parents: e254e65
Author: dpavlov <dpavlov@apache.org>
Authored: Tue Apr 17 16:25:37 2018 +0300
Committer: dpavlov <dpavlov@apache.org>
Committed: Tue Apr 17 16:25:37 2018 +0300

----------------------------------------------------------------------
 .../persistence/file/AlignedBuffersDirectFileIO.java      |  6 +++++-
 .../cache/persistence/file/IgniteNativeIoLib.java         | 10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/63dc75b8/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
index 681426c..0168d2a 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
@@ -471,7 +471,11 @@ public class AlignedBuffersDirectFileIO implements FileIO {
 
     /** {@inheritDoc} */
     @Override public void force(boolean withMetadata) throws IOException {
-        if (IgniteNativeIoLib.fsync(fdCheckOpened()) < 0)
+        int fd = fdCheckOpened();
+
+        int res = withMetadata ? IgniteNativeIoLib.fsync(fd) : IgniteNativeIoLib.fdatasync(fd);
+
+        if (res < 0)
             throw new IOException(String.format("Error fsync()'ing %s, got %s", file, getLastError()));
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63dc75b8/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
index 47f1e6a..65ef8d7 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
@@ -316,6 +316,16 @@ public class IgniteNativeIoLib {
     public static native int fsync(int fd);
 
     /**
+     * Synchronize a file's in-core state with storage device. See "man 2 fsync".
+     *
+     * Similar to {@link #fsync(int)}, but does not flush modified metadata unless that metadata
is needed in order to allow a subsequent data retrieval to be correctly handled
+     *
+     * @param fd file descriptor.
+     * @return On success return zero. On error, -1 is returned, and errno is set appropriately.
+     */
+    public static native int fdatasync(int fd);
+
+    /**
      * Allocates size bytes and places the address of the allocated memory in {@code memptr}.
      * The address of the allocated memory will be a multiple of {@code alignment}.
      *


Mime
View raw message