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 2013/06/03 09:32:01 UTC

git commit: clean up shaky LeveledCompactionStrategyTest

Updated Branches:
  refs/heads/trunk 88f2ebc5f -> 9e8691c26


clean up shaky LeveledCompactionStrategyTest


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

Branch: refs/heads/trunk
Commit: 9e8691c26283f2532be3101486a8290ed5128c18
Parents: 88f2ebc
Author: Marcus Eriksson <ma...@spotify.com>
Authored: Mon Jun 3 09:31:47 2013 +0200
Committer: Marcus Eriksson <ma...@spotify.com>
Committed: Mon Jun 3 09:31:47 2013 +0200

----------------------------------------------------------------------
 .../compaction/LeveledCompactionStrategyTest.java  |   21 +++++---------
 1 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e8691c2/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 4c70fe0..b33defc 100644
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@ -172,32 +172,27 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
             rm.apply();
             cfs.forceBlockingFlush();
         }
-
         waitForLeveling(cfs);
         LeveledCompactionStrategy strategy = (LeveledCompactionStrategy) cfs.getCompactionStrategy();
+        cfs.disableAutoCompaction();
+
+        while(CompactionManager.instance.getActiveCompactions() > 0)
+            Thread.sleep(100);
 
-        Set<SSTableReader> changedSSTables = new HashSet<SSTableReader>();
-        Collection<SSTableReader> sstables = cfs.getDataTracker().getUncompactingSSTables();
-        assert cfs.getDataTracker().markCompacting(sstables); // dont touch my sstables!
-        // change sstable level on all current sstables
-        for (SSTableReader s : sstables)
+        for (SSTableReader s : cfs.getSSTables())
         {
             assertTrue(s.getSSTableLevel() != 6);
             strategy.manifest.remove(s);
             LeveledManifest.mutateLevel(s.getSSTableMetadata(), s.descriptor, s.descriptor.filenameFor(Component.STATS), 6);
             s.reloadSSTableMetadata();
-            changedSSTables.add(s);
             strategy.manifest.add(s);
         }
         // verify that all sstables in the changed set is level 6
-        for (SSTableReader s : table.getColumnFamilyStore(cfname).getSSTables())
-        {
-            if (changedSSTables.contains(s))
-                assertTrue(s.getSSTableLevel() == 6);
-        }
+        for (SSTableReader s : cfs.getSSTables())
+            assertEquals(6, s.getSSTableLevel());
 
         int[] levels = strategy.manifest.getAllLevelSize();
         // verify that the manifest has correct amount of sstables
-        assertEquals(changedSSTables.size(), levels[6]);
+        assertEquals(cfs.getSSTables().size(), levels[6]);
     }
 }