cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [2/6] cassandra git commit: Permit disabling commit log segment recycling, and disable by default
Date Tue, 28 Jul 2015 16:37:12 GMT
Permit disabling commit log segment recycling, and disable by default

patch by benedict; reviewed by driftx for CASSANDRA-9896


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

Branch: refs/heads/cassandra-2.2
Commit: 8f70bb2f5d820079134cdef570d3c16083bc8c91
Parents: 9dbf32c
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Sat Jul 25 17:32:47 2015 +0100
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Tue Jul 28 17:34:25 2015 +0100

----------------------------------------------------------------------
 conf/cassandra.yaml                                             | 4 ++++
 src/java/org/apache/cassandra/config/Config.java                | 1 +
 src/java/org/apache/cassandra/config/DatabaseDescriptor.java    | 5 +++++
 .../apache/cassandra/db/commitlog/CommitLogSegmentManager.java  | 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f70bb2f/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 3047586..a3e54e5 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -255,6 +255,10 @@ commitlog_sync_period_in_ms: 10000
 # is reasonable.
 commitlog_segment_size_in_mb: 32
 
+# Reuse commit log files when possible. The default is false, and this
+# feature will be removed entirely in future versions of Cassandra.
+#commitlog_segment_recycling: false
+
 # any class that implements the SeedProvider interface and has a
 # constructor that takes a Map<String, String> of parameters will do.
 seed_provider:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f70bb2f/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 31e4cd5..fec6a70 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -164,6 +164,7 @@ public class Config
     public Double commitlog_sync_batch_window_in_ms;
     public Integer commitlog_sync_period_in_ms;
     public int commitlog_segment_size_in_mb = 32;
+    public boolean commitlog_segment_recycling = false;
 
     @Deprecated
     public int commitlog_periodic_queue_size = -1;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f70bb2f/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 68dcd5c..bbecc6b 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -1160,6 +1160,11 @@ public class DatabaseDescriptor
         conf.tombstone_failure_threshold = threshold;
     }
 
+    public static boolean getCommitLogSegmentRecyclingEnabled()
+    {
+        return conf.commitlog_segment_recycling;
+    }
+
     /**
      * size of commitlog segments to allocate
      */

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f70bb2f/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
index 3f7e793..ba37576 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
@@ -354,7 +354,7 @@ public class CommitLogSegmentManager
             discardSegment(segment, false);
             return;
         }
-        if (isCapExceeded())
+        if (isCapExceeded() || !DatabaseDescriptor.getCommitLogSegmentRecyclingEnabled())
         {
             discardSegment(segment, true);
             return;


Mime
View raw message