cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [1/3] cassandra git commit: Avoid overlap in L1 when L0 contains many non-overlapping sstables
Date Fri, 07 Nov 2014 12:45:50 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk a94b173e2 -> c63ee74b5


Avoid overlap in L1 when L0 contains many non-overlapping sstables

Patch by marcuse; reviewed by yukim for CASSANDRA-8211


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

Branch: refs/heads/trunk
Commit: 486885493471b5f20d86287d3fe03bc99a983fb1
Parents: 6b3f3e9
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Nov 4 11:39:29 2014 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Fri Nov 7 13:42:06 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/48688549/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8a7697b..2b3bd3c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.0.12:
+ * Avoid overlap in L1 when L0 contains many nonoverlapping
+   sstables (CASSANDRA-8211)
  * Improve PropertyFileSnitch logging (CASSANDRA-8183)
  * Abort liveRatio calculation if the memtable is flushed (CASSANDRA-8164)
  * Correctly handle non-text column names in cql3 (CASSANDRA-8178)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/48688549/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 b704523..aefd573 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -486,6 +486,16 @@ public class LeveledManifest
         {
             Set<SSTableReader> compactingL0 = ImmutableSet.copyOf(Iterables.filter(generations[0],
Predicates.in(compacting)));
 
+            RowPosition lastCompactingKey = null;
+            RowPosition firstCompactingKey = null;
+            for (SSTableReader candidate : compactingL0)
+            {
+                if (firstCompactingKey == null || candidate.first.compareTo(firstCompactingKey)
< 0)
+                    firstCompactingKey = candidate.first;
+                if (lastCompactingKey == null || candidate.last.compareTo(lastCompactingKey)
> 0)
+                    lastCompactingKey = candidate.last;
+            }
+
             // L0 is the dumping ground for new sstables which thus may overlap each other.
             //
             // We treat L0 compactions specially:
@@ -513,9 +523,7 @@ public class LeveledManifest
 
                 for (SSTableReader newCandidate : overlappedL0)
                 {
-                    // overlappedL0 could contain sstables that are not in compactingL0,
but do overlap
-                    // other sstables that are
-                    if (overlapping(newCandidate, compactingL0).isEmpty())
+                    if (firstCompactingKey == null || lastCompactingKey == null || overlapping(firstCompactingKey.getToken(),
lastCompactingKey.getToken(), Arrays.asList(newCandidate)).size() == 0)
                         candidates.add(newCandidate);
                     remaining.remove(newCandidate);
                 }


Mime
View raw message