cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject git commit: Don't allow marking already compacted sstables as compacting.
Date Mon, 01 Sep 2014 13:50:11 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-1.2 7f9e9a871 -> 8bef2609a


Don't allow marking already compacted sstables as compacting.

Patch by marcuse; reviewed by yukim for CASSANDRA-7145


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

Branch: refs/heads/cassandra-1.2
Commit: 8bef2609abf32e9524c3aa6c89e5f2d5b381efb6
Parents: 7f9e9a8
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Mon Sep 1 15:11:38 2014 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Mon Sep 1 15:11:38 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 src/java/org/apache/cassandra/db/DataTracker.java      | 13 +++++++++++++
 .../cassandra/db/compaction/LeveledManifest.java       |  5 ++++-
 .../org/apache/cassandra/io/sstable/SSTableReader.java |  5 +++++
 4 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bef2609/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d27be1f..6c601e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.19
+ * Don't allow compacted sstables to be marked as compacting (CASSANDRA-7145)
  * Track expired tombstones (CASSANDRA-7810)
  * Validate empty cell names from counter updates (CASSANDRA-7798)
  * Improve PasswordAuthenticator default super user setup (CASSANDRA-7788)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bef2609/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DataTracker.java b/src/java/org/apache/cassandra/db/DataTracker.java
index 3e271d3..a1092fa 100644
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@ -22,6 +22,7 @@ import java.util.*;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.atomic.AtomicReference;
 
+import com.google.common.base.Predicate;
 import com.google.common.collect.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -183,6 +184,18 @@ public class DataTracker
         if (inactive.size() < sstables.size())
             return false;
 
+        if (Iterables.any(sstables, new Predicate<SSTableReader>()
+        {
+            @Override
+            public boolean apply(SSTableReader sstable)
+            {
+                return sstable.isMarkedCompacted();
+            }
+        }))
+        {
+            return false;
+        }
+
         View newView = currentView.markCompacting(inactive);
         return view.compareAndSet(currentView, newView);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bef2609/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 fc10883..796eb90 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -529,7 +529,10 @@ public class LeveledManifest
                 // add sstables from L1 that overlap candidates
                 // if the overlapping ones are already busy in a compaction, leave it out.
                 // TODO try to find a set of L0 sstables that only overlaps with non-busy
L1 sstables
-                candidates = Sets.union(candidates, overlapping(candidates, generations[1]));
+                Set<SSTableReader> l1overlapping = overlapping(candidates, generations[1]);
+                if (Sets.intersection(l1overlapping, compacting).size() > 0)
+                    return Collections.emptyList();
+                candidates = Sets.union(candidates, l1overlapping);
             }
             // check overlap with L0 compacting sstables to make sure we are not generating
overlap in L1.
             Iterable<SSTableReader> compactingL0 = Iterables.filter(generations[0],
Predicates.in(compacting));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bef2609/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index 4af1cdc..ba7093c 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -994,6 +994,11 @@ public class SSTableReader extends SSTable implements Closeable
         return !isCompacted.getAndSet(true);
     }
 
+    public boolean isMarkedCompacted()
+    {
+        return isCompacted.get();
+    }
+
     public void markSuspect()
     {
         if (logger.isDebugEnabled())


Mime
View raw message