You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2014/02/13 08:47:50 UTC

git commit: Avoid overlaps in LCS by not skipping levels and verifying that the candidates don't overlap any compacting sstables.

Updated Branches:
  refs/heads/cassandra-2.0 5f60fcc39 -> 15ee94897


Avoid overlaps in LCS by not skipping levels and verifying that the candidates
don't overlap any compacting sstables.

Patch by marcuse, reviewed by jbellis for CASSANDRA-6688


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

Branch: refs/heads/cassandra-2.0
Commit: 15ee94897d7d8dae5b23c2a2112eb1564fada22b
Parents: 5f60fcc
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 13 08:42:13 2014 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 13 08:42:13 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../db/compaction/LeveledManifest.java          | 23 ++++----------------
 2 files changed, 6 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/15ee9489/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a4dc8fd..9509a76 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,4 @@
+2.0.6
  * Add compatibility for Hadoop 0.2.x (CASSANDRA-5201)
  * Fix EstimatedHistogram races (CASSANDRA-6682)
  * Failure detector correctly converts initial value to nanos (CASSANDRA-6658)
@@ -10,6 +11,7 @@
    time histogram (CASSANDRA-6522)
  * Stop CommitLogSegment.close() from calling sync() (CASSANDRA-6652)
  * Make commitlog failure handling configurable (CASSANDRA-6364)
+ * Avoid overlaps in LCS (CASSANDRA-6688)
 Merged from 1.2:
  * Fix broken streams when replacing with same IP (CASSANDRA-6622)
  * Fix upgradesstables NPE for non-CF-based indexes (CASSANDRA-6645)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/15ee9489/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 4347ad5..a78a867 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -113,23 +113,6 @@ public class LeveledManifest
         generations[level].add(reader);
     }
 
-    /**
-     * if the number of SSTables in the current compacted set *by itself* exceeds the target level's
-     * (regardless of the level's current contents), find an empty level instead
-     */
-    private int skipLevels(int newLevel, Iterable<SSTableReader> added)
-    {
-        // Note that we now check if the sstables included in the compaction, *before* the compaction, fit in the next level.
-        // This is needed since we need to decide before the actual compaction what level they will be in.
-        // This should be safe, we might skip levels where the compacted data could have fit but that should be ok.
-        while (maxBytesForLevel(newLevel) < SSTableReader.getTotalBytes(added)
-               && generations[(newLevel + 1)].isEmpty())
-        {
-            newLevel++;
-        }
-        return newLevel;
-    }
-
     public synchronized void replace(Collection<SSTableReader> removed, Collection<SSTableReader> added)
     {
         assert !removed.isEmpty(); // use add() instead of promote when adding new sstables
@@ -449,7 +432,10 @@ public class LeveledManifest
 
                 for (SSTableReader newCandidate : overlappedL0)
                 {
-                    candidates.add(newCandidate);
+                    // overlappedL0 could contain sstables that are not in compactingL0, but do overlap
+                    // other sstables that are
+                    if (overlapping(newCandidate, compactingL0).isEmpty())
+                        candidates.add(newCandidate);
                     remaining.remove(newCandidate);
                 }
 
@@ -572,7 +558,6 @@ public class LeveledManifest
         else
         {
             newLevel = minimumLevel == maximumLevel ? maximumLevel + 1 : maximumLevel;
-            newLevel = skipLevels(newLevel, sstables);
             assert newLevel > 0;
         }
         return newLevel;