You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by yu...@apache.org on 2015/08/27 17:20:58 UTC

[2/6] cassandra git commit: Fix LeveledCompactionStrategyTest#testMutateLevel

Fix LeveledCompactionStrategyTest#testMutateLevel

patch by yukim; reviewed by ariel for CASSANDRA-9575


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

Branch: refs/heads/cassandra-3.0
Commit: 408746c9032628ecee6522150cd4f5cc642442c6
Parents: 27bc7a5
Author: Yuki Morishita <yu...@apache.org>
Authored: Thu Aug 27 10:14:47 2015 -0500
Committer: Yuki Morishita <yu...@apache.org>
Committed: Thu Aug 27 10:14:47 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../db/compaction/LeveledCompactionStrategyTest.java        | 9 +++------
 2 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/408746c9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ea11489..6cffd18 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.1
+ * Fix LeveledCompactionStrategyTest (CASSANDRA-9757)
  * Fix broken UnbufferedDataOutputStreamPlus.writeUTF (CASSANDRA-10203)
  * (cqlsh) add CLEAR command (CASSANDRA-10086)
  * Support string literals as Role names for compatibility (CASSANDRA-10135)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/408746c9/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
index 63fd0e7..6b3383e 100644
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@ -255,6 +255,7 @@ public class LeveledCompactionStrategyTest
     @Test
     public void testMutateLevel() throws Exception
     {
+        cfs.disableAutoCompaction();
         ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make it easy to have multiple files
 
         // Enough data to have a level 1 and 2
@@ -273,17 +274,13 @@ public class LeveledCompactionStrategyTest
             rm.applyUnsafe();
             cfs.forceBlockingFlush();
         }
-        waitForLeveling(cfs);
         cfs.forceBlockingFlush();
         LeveledCompactionStrategy strategy = (LeveledCompactionStrategy) ((WrappingCompactionStrategy) cfs.getCompactionStrategy()).getWrappedStrategies().get(1);
-        cfs.disableAutoCompaction();
-
-        while(CompactionManager.instance.isCompacting(Arrays.asList(cfs)))
-            Thread.sleep(100);
+        cfs.forceMajorCompaction();
 
         for (SSTableReader s : cfs.getSSTables())
         {
-            assertTrue(s.getSSTableLevel() != 6);
+            assertTrue(s.getSSTableLevel() != 6 && s.getSSTableLevel() > 0);
             strategy.manifest.remove(s);
             s.descriptor.getMetadataSerializer().mutateLevel(s.descriptor, 6);
             s.reloadSSTableMetadata();