Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F2B9C200C47 for ; Thu, 23 Feb 2017 03:14:24 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F1757160B7E; Thu, 23 Feb 2017 02:14:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1BFC9160B7C for ; Thu, 23 Feb 2017 03:14:23 +0100 (CET) Received: (qmail 83078 invoked by uid 500); 23 Feb 2017 02:14:23 -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 82928 invoked by uid 99); 23 Feb 2017 02:14:23 -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; Thu, 23 Feb 2017 02:14:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0447FDFF12; Thu, 23 Feb 2017 02:14:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yukim@apache.org To: commits@cassandra.apache.org Date: Thu, 23 Feb 2017 02:14:26 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [05/10] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0 archived-at: Thu, 23 Feb 2017 02:14:25 -0000 Merge branch 'cassandra-2.2' into cassandra-3.0 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/61f0c988 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/61f0c988 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/61f0c988 Branch: refs/heads/cassandra-3.11 Commit: 61f0c988f78c00fec2c4e028cfb793b84069f737 Parents: 51796ea 6ffd5cc Author: Yuki Morishita Authored: Thu Feb 23 11:01:32 2017 +0900 Committer: Yuki Morishita Committed: Thu Feb 23 11:01:32 2017 +0900 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../LongLeveledCompactionStrategyTest.java | 58 ++++++++++++-------- .../LeveledCompactionStrategyTest.java | 2 +- 3 files changed, 37 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index afda236,033b366..e978a5c --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,7 -1,5 +1,8 @@@ -2.2.10 +3.0.12 + * Remove unnecessary assertion from AntiCompactionTest (CASSANDRA-13070) + * Fix cqlsh COPY for dates before 1900 (CASSANDRA-13185) +Merged from 2.2 + * Fix flaky LongLeveledCompactionStrategyTest (CASSANDRA-12202) * Fix failing COPY TO STDOUT (CASSANDRA-12497) * Fix ColumnCounter::countAll behaviour for reverse queries (CASSANDRA-13222) * Exceptions encountered calling getSeeds() breaks OTC thread (CASSANDRA-13018) http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java ---------------------------------------------------------------------- diff --cc test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java index 79497aa,8e63006..562de22 --- a/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java +++ b/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java @@@ -53,9 -51,14 +55,11 @@@ public class LongLeveledCompactionStrat leveledOptions.put("sstable_size_in_mb", "1"); SchemaLoader.prepareServer(); SchemaLoader.createKeyspace(KEYSPACE1, - SimpleStrategy.class, - KSMetaData.optsWithRF(1), + KeyspaceParams.simple(1), SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARDLVL) - .compactionStrategyClass(LeveledCompactionStrategy.class) - .compactionStrategyOptions(leveledOptions), ++ .compaction(CompactionParams.lcs(leveledOptions)), + SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARDLVL2) - .compactionStrategyClass(LeveledCompactionStrategy.class) - .compactionStrategyOptions(leveledOptions)); + .compaction(CompactionParams.lcs(leveledOptions))); } @Test @@@ -145,15 -149,34 +149,14 @@@ @Test public void testLeveledScanner() throws Exception { - testParallelLeveledCompaction(); Keyspace keyspace = Keyspace.open(KEYSPACE1); - ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL); - final ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL2); - WrappingCompactionStrategy strategy = ((WrappingCompactionStrategy) store.getCompactionStrategy()); - final LeveledCompactionStrategy lcs = (LeveledCompactionStrategy) strategy.getWrappedStrategies().get(1); - - ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make it easy to have multiple files ++ ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL2); + store.disableAutoCompaction(); - // Enough data to have a level 1 and 2 - int rows = 128; - int columns = 10; + LeveledCompactionStrategy lcs = (LeveledCompactionStrategy)store.getCompactionStrategyManager().getStrategies().get(1); - ByteBuffer value = ByteBuffer.wrap(new byte[10 * 1024]); // 10 KB value - // Adds enough data to trigger multiple sstable per level - for (int r = 0; r < rows; r++) - { - DecoratedKey key = Util.dk(String.valueOf(r)); - Mutation rm = new Mutation(KEYSPACE1, key.getKey()); - for (int c = 0; c < columns; c++) - { - rm.add(CF_STANDARDLVL2, Util.cellname("column" + c), value, 0); - } - rm.apply(); - store.forceBlockingFlush(); - } ++ ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make it easy to have multiple files - value = ByteBuffer.wrap(new byte[10 * 1024]); // 10 KB value - LeveledCompactionStrategyTest.waitForLeveling(store); - // wait for higher-level compactions to finish - store.disableAutoCompaction(); // Adds 10 partitions for (int r = 0; r < 10; r++) { @@@ -169,33 -192,40 +172,42 @@@ //Flush sstable store.forceBlockingFlush(); - Iterable allSSTables = store.getSSTables(SSTableSet.LIVE); - for (SSTableReader sstable : allSSTables) + store.runWithCompactionsDisabled(new Callable() { - if (sstable.getSSTableLevel() == 0) + public Void call() throws Exception { - System.out.println("Mutating L0-SSTABLE level to L1 to simulate a bug: " + sstable.getFilename()); - sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 1); - sstable.reloadSSTableMetadata(); - } - } - Collection allSSTables = store.getSSTables(); ++ Iterable allSSTables = store.getSSTables(SSTableSet.LIVE); + for (SSTableReader sstable : allSSTables) + { + if (sstable.getSSTableLevel() == 0) + { + System.out.println("Mutating L0-SSTABLE level to L1 to simulate a bug: " + sstable.getFilename()); + sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 1); + sstable.reloadSSTableMetadata(); + } + } - try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(Lists.newArrayList(allSSTables))) - { - //Verify that leveled scanners will always iterate in ascending order (CASSANDRA-9935) - for (ISSTableScanner scanner : scannerList.scanners) - { - DecoratedKey lastKey = null; - while (scanner.hasNext()) - try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(allSSTables)) ++ try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(Lists.newArrayList(allSSTables))) { - UnfilteredRowIterator row = scanner.next(); - if (lastKey != null) + //Verify that leveled scanners will always iterate in ascending order (CASSANDRA-9935) + for (ISSTableScanner scanner : scannerList.scanners) { - assertTrue("row " + row.partitionKey() + " received out of order wrt " + lastKey, row.partitionKey().compareTo(lastKey) >= 0); + DecoratedKey lastKey = null; + while (scanner.hasNext()) + { - OnDiskAtomIterator row = scanner.next(); ++ UnfilteredRowIterator row = scanner.next(); + if (lastKey != null) + { - assertTrue("row " + row.getKey() + " received out of order wrt " + lastKey, row.getKey().compareTo(lastKey) >= 0); ++ assertTrue("row " + row.partitionKey() + " received out of order wrt " + lastKey, row.partitionKey().compareTo(lastKey) >= 0); + } - lastKey = row.getKey(); ++ lastKey = row.partitionKey(); + } } - lastKey = row.partitionKey(); } + return null; } - } - }, true); ++ }, true, true); ++ ++ } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java index 1277209,0047678..636afe1 --- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java @@@ -194,9 -207,9 +194,9 @@@ public class LeveledCompactionStrategyT /** * wait for leveled compaction to quiesce on the given columnfamily */ - private void waitForLeveling(ColumnFamilyStore cfs) throws InterruptedException + public static void waitForLeveling(ColumnFamilyStore cfs) throws InterruptedException { - WrappingCompactionStrategy strategyManager = (WrappingCompactionStrategy)cfs.getCompactionStrategy(); + CompactionStrategyManager strategyManager = cfs.getCompactionStrategyManager(); while (true) { // since we run several compaction strategies we wait until L0 in all strategies is empty and