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 2017/11/30 13:47:39 UTC
[3/6] ignite git commit: IGNITE-7016 Avoid WAL segment fsync on
header write in non-default mode
IGNITE-7016 Avoid WAL segment fsync on header write in non-default mode
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c2b145a1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c2b145a1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c2b145a1
Branch: refs/heads/ignite-zk
Commit: c2b145a1b14160dcf645d7ceddb2b5d58b40b43a
Parents: 5fa9de3
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Nov 29 19:13:20 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 29 19:13:20 2017 +0300
----------------------------------------------------------------------
.../wal/FileWriteAheadLogManager.java | 22 +++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c2b145a1/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 a450521..948a8ae 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
@@ -1304,16 +1304,19 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
synchronized (this) {
while (locked.containsKey(toArchive) && !stopped)
wait();
+ }
- // Firstly, format working file
- if (!stopped)
- formatFile(res.getOrigWorkFile());
+ // Firstly, format working file
+ if (!stopped)
+ formatFile(res.getOrigWorkFile());
+ synchronized (this) {
// Then increase counter to allow rollover on clean working file
changeLastArchivedIndexAndWakeupCompressor(toArchive);
notifyAll();
}
+
if (evt.isRecordable(EventType.EVT_WAL_SEGMENT_ARCHIVED))
evt.record(new WalSegmentArchivedEvent(cctx.discovery().localNode(),
res.getAbsIdx(), res.getDstArchiveFile()));
@@ -1369,7 +1372,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
return curAbsWalIdx;
}
}
- catch (InterruptedException e) {
+ catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IgniteInterruptedCheckedException(e);
@@ -1889,7 +1892,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @return I/O position after write version.
* @throws IOException If failed to write serializer version.
*/
- public static long writeSerializerVersion(FileIO io, long idx, int version) throws IOException {
+ public static long writeSerializerVersion(FileIO io, long idx, int version, WALMode mode) throws IOException {
ByteBuffer buffer = prepareSerializerVersionBuffer(idx, version, false);
do {
@@ -1898,7 +1901,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
while (buffer.hasRemaining());
// Flush
- io.force();
+ if (mode == WALMode.DEFAULT)
+ io.force();
return io.position();
}
@@ -2205,9 +2209,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
*/
public void writeSerializerVersion() throws IgniteCheckedException {
try {
- assert fileIO.position() == 0 : "Serializer version can be written only at the begin of file " + fileIO.position();
+ assert fileIO.position() == 0 : "Serializer version can be written only at the begin of file " +
+ fileIO.position();
- long updatedPosition = FileWriteAheadLogManager.writeSerializerVersion(fileIO, idx, serializer.version());
+ long updatedPosition = FileWriteAheadLogManager.writeSerializerVersion(fileIO, idx,
+ serializer.version(), mode);
written = updatedPosition;
lastFsyncPos = updatedPosition;