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 2012/03/02 19:34:13 UTC

[2/2] git commit: don't change manifest level for cleanup, scrub, and upgradesstables under LCS patch by Maki Watanabe; reviewed by jbellis for CASSANDRA-3989

don't change manifest level for cleanup, scrub, and upgradesstables under LCS
patch by Maki Watanabe; reviewed by jbellis for CASSANDRA-3989


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

Branch: refs/heads/cassandra-1.1
Commit: 1c56ec2da2664abaab63b504b34767a1a5e8386e
Parents: 4299d07
Author: Jonathan Ellis <jb...@apache.org>
Authored: Fri Mar 2 12:28:36 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Fri Mar 2 12:33:23 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    4 +++-
 .../cassandra/db/compaction/LeveledManifest.java   |   10 ++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c56ec2d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4eb42f4..358644a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,7 @@
  * optimize commitlog checksumming (CASSANDRA-3610)
  * identify and blacklist corrupted SSTables from future compactions (CASSANDRA-2261)
 
+
 1.1-dev
  * start hint replay as soon as FD notifies that the target is back up
    (CASSANDRA-3958)
@@ -27,6 +28,8 @@ Merged from 1.0:
  * (cqlsh) ignore missing CfDef opts (CASSANDRA-3933)
  * (cqlsh) look for cqlshlib relative to realpath (CASSANDRA-3767)
  * Fix short read protection (CASSANDRA-3934)
+ * don't change manifest level for cleanup, scrub, and upgradesstables
+   operations under LeveledCompactionStrategy (CASSANDRA-3989)
  * always compact away deleted hints immediately after handoff (CASSANDRA-3955)
  * delete hints from dropped ColumnFamilies on handoff instead of
    erroring out (CASSANDRA-3975)
@@ -35,7 +38,6 @@ Merged from 1.0:
  * Pig: Composite column support (CASSANDRA-384)
 
 
-
 1.1-beta1
  * add nodetool rebuild_index (CASSANDRA-3583)
  * add nodetool rangekeysample (CASSANDRA-2917)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c56ec2d/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 2661c6d..2d0a253 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -63,7 +63,6 @@ public class LeveledManifest
     private final List<SSTableReader>[] generations;
     private final RowPosition[] lastCompactedKeys;
     private final int maxSSTableSizeInMB;
-    private int levelCount;
 
     private LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB)
     {
@@ -177,7 +176,13 @@ public class LeveledManifest
         if (!added.iterator().hasNext())
             return;
 
-        int newLevel = minimumLevel == maximumLevel ? maximumLevel + 1 : maximumLevel;
+        // avoid increasing the level if we had a single source sstable involved.  This prevents
+        // cleanup, scrub, and upgradesstables from blowing through the level cap.
+        // See CASSANDRA-3989
+        int newLevel = Iterables.size(removed) == 1
+                     ? maximumLevel
+                     : minimumLevel == maximumLevel ? maximumLevel + 1 : maximumLevel;
+
         newLevel = skipLevels(newLevel, added);
         assert newLevel > 0;
         if (logger.isDebugEnabled())
@@ -321,6 +326,7 @@ public class LeveledManifest
 
     private void add(SSTableReader sstable, int level)
     {
+        assert level < generations.length : "Invalid level " + level + " out of " + (generations.length - 1);
         generations[level].add(sstable);
     }