cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [12/16] git commit: make cache skipping optional patch by harishd; reviewed by Vijay for CASSANDRA-2635
Date Fri, 13 Apr 2012 15:36:06 GMT
make cache skipping optional
patch by harishd; reviewed by Vijay for CASSANDRA-2635


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

Branch: refs/heads/trunk
Commit: 20bd8281fab66852659201a76a9c525cdf64b710
Parents: c215a4c
Author: Vijay Parthasarathy <vijay2win@gmail.com>
Authored: Thu Apr 12 20:54:47 2012 -0700
Committer: Vijay Parthasarathy <vijay2win@gmail.com>
Committed: Thu Apr 12 20:54:47 2012 -0700

----------------------------------------------------------------------
 conf/cassandra.yaml                                |    5 +++++
 src/java/org/apache/cassandra/config/Config.java   |    1 +
 .../cassandra/config/DatabaseDescriptor.java       |    7 +++++++
 .../apache/cassandra/io/sstable/SSTableWriter.java |    8 +++++---
 4 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/20bd8281/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 0d94b0b..2f6a7da 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -29,6 +29,11 @@ max_hint_window_in_ms: 3600000 # one hour
 # Sleep this long after delivering each hint
 hinted_handoff_throttle_delay_in_ms: 1
 
+# The following setting populates the page cache on memtable flush and compaction
+# WARNING: Enable this setting only when the whole node's data fits in memory.
+# Defaults to: false
+# populate_buffer_cache_on_flush: false
+
 # authentication backend, implementing IAuthenticator; used to identify users
 authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/20bd8281/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 253594b..cb1847e 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -136,6 +136,7 @@ public class Config
     public int row_cache_save_period = 0;
     public int row_cache_keys_to_save = Integer.MAX_VALUE;
     public String row_cache_provider = ConcurrentLinkedHashCacheProvider.class.getSimpleName();
+    public boolean populate_io_cache_on_flush = false;
 
     private static boolean loadYaml = true;
     private static boolean outboundBindAny = false;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/20bd8281/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index e74ac13..b6a1d4e 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -194,6 +194,8 @@ public class DatabaseDescriptor
             if (conf.disk_access_mode == Config.DiskAccessMode.mmap)
                 MmappedSegmentedFile.initCleaner();
 
+	        logger.debug("page_cache_hinting is " + conf.populate_io_cache_on_flush);
+
             /* Authentication and authorization backend, implementing IAuthenticator and
IAuthority */
             if (conf.authenticator != null)
                 authenticator = FBUtilities.<IAuthenticator>construct(conf.authenticator,
"authenticator");
@@ -1056,4 +1058,9 @@ public class DatabaseDescriptor
     {
         return conf.streaming_socket_timeout_in_ms;
     }
+
+    public static boolean populateIOCacheOnFlush()
+    {
+        return conf.populate_io_cache_on_flush;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/20bd8281/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index b1fcc79..d74514f 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -90,14 +90,15 @@ public class SSTableWriter extends SSTable
             dbuilder = SegmentedFile.getCompressedBuilder();
             dataFile = CompressedSequentialWriter.open(getFilename(),
                                                        descriptor.filenameFor(Component.COMPRESSION_INFO),
-                                                       true,
+                                                       !DatabaseDescriptor.populateIOCacheOnFlush(),
                                                        metadata.compressionParameters(),
                                                        sstableMetadataCollector);
         }
         else
         {
             dbuilder = SegmentedFile.getBuilder(DatabaseDescriptor.getDiskAccessMode());
-            dataFile = SequentialWriter.open(new File(getFilename()), true);
+            dataFile = SequentialWriter.open(new File(getFilename()), 
+			                      !DatabaseDescriptor.populateIOCacheOnFlush());
             dataFile.setComputeDigest();
         }
 
@@ -395,7 +396,8 @@ public class SSTableWriter extends SSTable
 
         IndexWriter(long keyCount) throws IOException
         {
-            indexFile = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_INDEX)),
true);
+            indexFile = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_INDEX)),
+                                              !DatabaseDescriptor.populateIOCacheOnFlush());
             builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
             summary = new IndexSummary(keyCount);
 


Mime
View raw message