cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [3/3] git commit: Fix exception during cleanup for Leveled compaction
Date Tue, 03 Apr 2012 16:07:37 GMT
Fix exception during cleanup for Leveled compaction

patch by jbellis & slebresne; reviewed by jbellis & slebresne for CASSANDRA-4112


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

Branch: refs/heads/cassandra-1.1.0
Commit: 3fd0fb6aa0038f0c8aaf34f98f2ceed2f308a501
Parents: 67e88da
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Apr 3 16:32:58 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Apr 3 16:32:58 2012 +0200

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3fd0fb6a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7dae655..457b8cc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,7 +9,7 @@
  * Avoid NPE during repair when a keyspace has no CFs (CASSANDRA-3988)
  * Fix division-by-zero error on get_slice (CASSANDRA-4000)
  * don't change manifest level for cleanup, scrub, and upgradesstables
-   operations under LeveledCompactionStrategy (CASSANDRA-3989)
+   operations under LeveledCompactionStrategy (CASSANDRA-3989, 4112)
  * fix race leading to super columns assertion failure (CASSANDRA-3957)
  * ensure that directory is selected for compaction for user-defined
    tasks and upgradesstables (CASSANDRA-3985)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3fd0fb6a/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 6dc6ce9..0d949fc 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -188,17 +188,17 @@ public class LeveledManifest
 
     public synchronized void replace(Iterable<SSTableReader> removed, Iterable<SSTableReader>
added)
     {
-        // replace is for compaction operation that don't really change the
-        // content of a sstable (cleanup, scrub) and much replace one sstable by another
-        assert Iterables.size(removed) == 1;
-        assert Iterables.size(added) == 1;
-        SSTableReader toRemove = removed.iterator().next();
-        SSTableReader toAdd = added.iterator().next();
+        // replace is for compaction operation that operate on exactly one sstable, with
no merging.
+        // Thus, removed will be exactly one sstable, and added will be 0 or 1.
+        assert Iterables.size(removed) == 1 : Iterables.size(removed);
+        assert Iterables.size(added) <= 1 : Iterables.size(added);
         logDistribution();
-        if (logger.isDebugEnabled())
-            logger.debug("Replacing " + removed + " by " + toAdd);
+        logger.debug("Replacing {} with {}", removed, added);
+
+        int level = remove(removed.iterator().next());
+        if (!Iterables.isEmpty(added))
+            add(added.iterator().next(), level);
 
-        add(toAdd, remove(toRemove));
         serialize();
     }
 


Mime
View raw message