Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B6B27189DE for ; Wed, 19 Aug 2015 14:27:04 +0000 (UTC) Received: (qmail 52234 invoked by uid 500); 19 Aug 2015 14:26:42 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 52148 invoked by uid 500); 19 Aug 2015 14:26:42 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 51808 invoked by uid 99); 19 Aug 2015 14:26:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2015 14:26:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3E6ACDFC8B; Wed, 19 Aug 2015 14:26:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jmckenzie@apache.org To: commits@cassandra.apache.org Date: Wed, 19 Aug 2015 14:26:42 -0000 Message-Id: <5739a49f5a01442a8a6c8795743d53e2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] cassandra git commit: Fix LeveledCompactionStrategyTest on Windows Repository: cassandra Updated Branches: refs/heads/trunk bc0e695e2 -> b83b674ee 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/trunk Commit: de2e0a6c9a853234a381b28839f4736b666dc2a3 Parents: fce8478 Author: Joshua McKenzie Authored: Wed Aug 19 10:25:06 2015 -0400 Committer: Joshua McKenzie 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> groupedSSTables = cfs.getCompactionStrategy().groupSSTablesForAntiCompaction(cfs.getSSTables()); for (Collection sstableGroup : groupedSSTables)