You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2014/03/12 22:49:07 UTC
[2/3] git commit: Apply DONTNEED fadvise to commitlog segments patch
by Benedict Elliott Smith; reviewed by jbellis for CASSANDRA-6759
Apply DONTNEED fadvise to commitlog segments
patch by Benedict Elliott Smith; reviewed by jbellis for CASSANDRA-6759
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/773dda7d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/773dda7d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/773dda7d
Branch: refs/heads/trunk
Commit: 773dda7d547453b3e24c5827d7b43d73751bfdec
Parents: 2e227eb
Author: Jonathan Ellis <jb...@apache.org>
Authored: Wed Mar 12 16:48:34 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Wed Mar 12 16:48:48 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/db/commitlog/CommitLogSegment.java | 5 +++++
2 files changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/773dda7d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1ef2b93..d346499 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.0-beta2
+ * Apply DONTNEED fadvise to commitlog segments (CASSANDRA-6759)
* Switch CRC component to Adler and include it for compressed sstables
(CASSANDRA-4165)
* Allow cassandra-stress to set compaction strategy options (CASSANDRA-6451)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/773dda7d/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index a47fcc0..9caba6d 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@ -18,6 +18,7 @@
package org.apache.cassandra.db.commitlog;
import java.io.File;
+import java.io.FileDescriptor;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
@@ -34,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.cassandra.utils.CLibrary;
import org.apache.cassandra.utils.concurrent.OpOrder;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
@@ -95,6 +97,7 @@ public class CommitLogSegment
private final File logFile;
private final RandomAccessFile logFileAccessor;
+ private final int fd;
private final MappedByteBuffer buffer;
@@ -150,6 +153,7 @@ public class CommitLogSegment
// (We may have restarted after a segment size configuration change, leaving "incorrectly"
// sized segments on disk.)
logFileAccessor.setLength(DatabaseDescriptor.getCommitLogSegmentSize());
+ fd = CLibrary.getfd(logFileAccessor.getFD());
buffer = logFileAccessor.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, DatabaseDescriptor.getCommitLogSegmentSize());
// mark the initial header as uninitialised
@@ -317,6 +321,7 @@ public class CommitLogSegment
close();
nextMarker = buffer.capacity();
}
+ CLibrary.trySkipCache(fd, offset, nextMarker);
lastSyncedOffset = nextMarker;
}