cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/5] git commit: ignore min/max compactions settings in LCS patch by slebresne and jbellis for CASSANDRA-4233
Date Fri, 18 May 2012 16:39:38 GMT
ignore min/max compactions settings in LCS
patch by slebresne and jbellis for CASSANDRA-4233


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

Branch: refs/heads/cassandra-1.1
Commit: d90f0f3e7a2597a4327d39b3047bd34ab9af0c70
Parents: 827de3f
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri May 18 11:36:02 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri May 18 11:36:02 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +
 .../apache/cassandra/db/CollationController.java   |    2 +-
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    2 +-
 .../db/compaction/LeveledCompactionStrategy.java   |   20 +++++++++------
 .../db/compaction/LeveledCompactionTask.java       |    5 +++
 .../cassandra/db/compaction/LeveledManifest.java   |    2 +-
 6 files changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 46646bf..a375f36 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1.1-dev
+ * ignore min/max compactions settings in LCS, while preserving
+   behavior that min=max=0 disables autocompaction (CASSANDRA-4233)
  * log number of rows read from saved cache (CASSANDRA-4249)
  * calculate exact size required for cleanup operations (CASSANDRA-1404)
  * avoid blocking additional writes during flush when the commitlog

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/src/java/org/apache/cassandra/db/CollationController.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java
index c73e1e0..8121062 100644
--- a/src/java/org/apache/cassandra/db/CollationController.java
+++ b/src/java/org/apache/cassandra/db/CollationController.java
@@ -76,7 +76,7 @@ public class CollationController
     {
         logger.debug("collectTimeOrderedData");
 
-        // AtomicSortedColumns doesn't work for super columns (see #3821)
+        // AtomicSortedColumns doesn't work for super columi ns (see #3821)
         ISortedColumns.Factory factory = mutableColumns
                                        ? cfs.metadata.cfType == ColumnFamilyType.Super ?
ThreadSafeSortedColumns.factory() : AtomicSortedColumns.factory()
                                        : TreeMapBackedSortedColumns.factory();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index c55d924..d15020a 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -1844,7 +1844,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         this.maxCompactionThreshold.set(maxCompactionThreshold);
     }
 
-    public boolean isCompactionDisabled()
+    public boolean giisCompactionDisabled()
     {
         return getMinimumCompactionThreshold() <= 0 || getMaximumCompactionThreshold()
<= 0;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
index 858a2bc..7fb58be 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
@@ -79,9 +79,6 @@ public class LeveledCompactionStrategy extends AbstractCompactionStrategy
implem
 
         manifest = LeveledManifest.create(cfs, this.maxSSTableSizeInMB);
         logger.debug("Created {}", manifest);
-        // override min/max for this strategy
-        cfs.setMaximumCompactionThreshold(Integer.MAX_VALUE);
-        cfs.setMinimumCompactionThreshold(1);
     }
 
     public void shutdown()
@@ -95,8 +92,20 @@ public class LeveledCompactionStrategy extends AbstractCompactionStrategy
implem
         return manifest.getLevelSize(i);
     }
 
+    /**
+     * the only difference between background and maximal in LCS is that maximal is still
allowed
+     * (by explicit user request) even when compaction is disabled.
+     */
     public AbstractCompactionTask getNextBackgroundTask(int gcBefore)
     {
+        if (cfs.isCompactionDisabled())
+            return null;
+
+        return getMaximalTask(gcBefore);
+    }
+
+    public AbstractCompactionTask getMaximalTask(int gcBefore)
+    {
         LeveledCompactionTask currentTask = task.get();
         if (currentTask != null && !currentTask.isDone())
         {
@@ -117,11 +126,6 @@ public class LeveledCompactionStrategy extends AbstractCompactionStrategy
implem
                : null;
     }
 
-    public AbstractCompactionTask getMaximalTask(int gcBefore)
-    {
-        return getNextBackgroundTask(gcBefore);
-    }
-
     public AbstractCompactionTask getUserDefinedTask(Collection<SSTableReader> sstables,
int gcBefore)
     {
         throw new UnsupportedOperationException("LevelDB compaction strategy does not allow
user-specified compactions");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java
index 2565466..4c3075f 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java
@@ -61,6 +61,11 @@ public class LeveledCompactionTask extends CompactionTask
         return latch.getCount() == 0;
     }
 
+    public boolean markSSTablesForCompaction(int min, int max)
+    {
+        return super.markSSTablesForCompaction(1, Integer.MAX_VALUE);
+    }
+
     @Override
     protected boolean newSSTableSegmentThresholdReached(SSTableWriter writer, long position)
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d90f0f3e/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
index 69ab492..da72499 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -462,7 +462,7 @@ public class LeveledManifest
         return generations[i];
     }
 
-    public int getEstimatedTasks()
+    public synchronized int getEstimatedTasks()
     {
         long tasks = 0;
         for (int i = generations.length - 1; i >= 0; i--)


Mime
View raw message