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/11/07 13:45:09 UTC
cassandra git commit: Avoid overlap in L1 when L0 contains many
non-overlapping sstables
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 6b3f3e960 -> 486885493
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/cassandra-2.0
Commit: 486885493471b5f20d86287d3fe03bc99a983fb1
Parents: 6b3f3e9
Author: Marcus Eriksson <ma...@apache.org>
Authored: Tue Nov 4 11:39:29 2014 +0100
Committer: Marcus Eriksson <ma...@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);
}