cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [1/2] cassandra git commit: Fix LeveledCompactionStrategyTest on Windows
Date Wed, 19 Aug 2015 14:26:35 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 db782362a -> 811ee6ca2


Fix LeveledCompactionStrategyTest on Windows

Patch by jmckenzie; reviewed by marcuse for CASSANDRA-10115


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

Branch: refs/heads/cassandra-3.0
Commit: de2e0a6c9a853234a381b28839f4736b666dc2a3
Parents: fce8478
Author: Joshua McKenzie <jmckenzie@apache.org>
Authored: Wed Aug 19 10:25:06 2015 -0400
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Wed Aug 19 10:25:06 2015 -0400

----------------------------------------------------------------------
 .../LeveledCompactionStrategyTest.java          | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/de2e0a6c/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 c7935fe..ccfc6ab 100644
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@ -28,12 +28,16 @@ import java.util.Random;
 import java.util.UUID;
 
 import org.apache.cassandra.io.sstable.format.SSTableReader;
+import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.cassandra.OrderedJUnit4ClassRunner;
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
@@ -61,6 +65,8 @@ import static org.junit.Assert.assertTrue;
 @RunWith(OrderedJUnit4ClassRunner.class)
 public class LeveledCompactionStrategyTest
 {
+    private static final Logger logger = LoggerFactory.getLogger(LeveledCompactionStrategyTest.class);
+
     private static final String KEYSPACE1 = "LeveledCompactionStrategyTest";
     private static final String CF_STANDARDDLEVELED = "StandardLeveled";
     private Keyspace keyspace;
@@ -108,8 +114,8 @@ public class LeveledCompactionStrategyTest
         new Random().nextBytes(value.array());
 
         // Enough data to have a level 1 and 2
-        int rows = 20;
-        int columns = 10;
+        int rows = 40;
+        int columns = 20;
 
         // Adds enough data to trigger multiple sstable per level
         for (int r = 0; r < rows; r++)
@@ -127,8 +133,15 @@ public class LeveledCompactionStrategyTest
         waitForLeveling(cfs);
         WrappingCompactionStrategy strategy = (WrappingCompactionStrategy) cfs.getCompactionStrategy();
         // Checking we're not completely bad at math
-        assert strategy.getSSTableCountPerLevel()[1] > 0;
-        assert strategy.getSSTableCountPerLevel()[2] > 0;
+        int l1Count = strategy.getSSTableCountPerLevel()[1];
+        int l2Count = strategy.getSSTableCountPerLevel()[2];
+        if (l1Count == 0 || l2Count == 0)
+        {
+            logger.error("L1 or L2 has 0 sstables. Expected > 0 on both.");
+            logger.error("L1: " + l1Count);
+            logger.error("L2: " + l2Count);
+            Assert.fail();
+        }
 
         Collection<Collection<SSTableReader>> groupedSSTables = cfs.getCompactionStrategy().groupSSTablesForAntiCompaction(cfs.getSSTables());
         for (Collection<SSTableReader> sstableGroup : groupedSSTables)


Mime
View raw message