Merge branch 'cassandra-2.0' into cassandra-2.1 Conflicts: CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fb1eaab4 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fb1eaab4 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fb1eaab4 Branch: refs/heads/cassandra-2.1 Commit: fb1eaab4120e766162b2dc397274dc68a499a4dd Parents: a8dce22 04eba90 Author: T Jake Luciani <j...@apache.org> Authored: Wed May 27 16:19:51 2015 -0400 Committer: T Jake Luciani <j...@apache.org> Committed: Wed May 27 16:19:51 2015 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/io/compress/CompressionParameters.java | 2 +- test/unit/org/apache/cassandra/cql3/CrcCheckChanceTest.java | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/fb1eaab4/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index d00cc65,58f3c53..ecd380d --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,36 -1,8 +1,37 @@@ -2.0.16: +2.1.6 + * (cqlsh) Better float precision by default (CASSANDRA-9224) + * Improve estimated row count (CASSANDRA-9107) + * Optimize range tombstone memory footprint (CASSANDRA-8603) + * Use configured gcgs in anticompaction (CASSANDRA-9397) + * Warn on misuse of unlogged batches (CASSANDRA-9282) + * Failure detector detects and ignores local pauses (CASSANDRA-9183) + * Add utility class to support for rate limiting a given log statement (CASSANDRA-9029) + * Add missing consistency levels to cassandra-stess (CASSANDRA-9361) + * Fix commitlog getCompletedTasks to not increment (CASSANDRA-9339) + * Fix for harmless exceptions logged as ERROR (CASSANDRA-8564) + * Delete processed sstables in sstablesplit/sstableupgrade (CASSANDRA-8606) + * Improve sstable exclusion from partition tombstones (CASSANDRA-9298) + * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057) + * Add support for top-k custom 2i queries (CASSANDRA-8717) + * Fix error when dropping table during compaction (CASSANDRA-9251) + * cassandra-stress supports validation operations over user profiles (CASSANDRA-8773) + * Add support for rate limiting log messages (CASSANDRA-9029) + * Log the partition key with tombstone warnings (CASSANDRA-8561) + * Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271) + * Fix PITR commitlog replay (CASSANDRA-9195) + * GCInspector logs very different times (CASSANDRA-9124) + * Fix deleting from an empty list (CASSANDRA-9198) + * Update tuple and collection types that use a user-defined type when that UDT + is modified (CASSANDRA-9148, CASSANDRA-9192) + * Use higher timeout for prepair and snapshot in repair (CASSANDRA-9261) + * Fix anticompaction blocking ANTI_ENTROPY stage (CASSANDRA-9151) + * Repair waits for anticompaction to finish (CASSANDRA-9097) + * Fix streaming not holding ref when stream error (CASSANDRA-9295) + * Fix canonical view returning early opened SSTables (CASSANDRA-9396) +Merged from 2.0: + * Fix potential StackOverflow when setting CrcCheckChance over JMX (CASSANDRA-9488) * Fix null static columns in pages after the first, paged reversed queries (CASSANDRA-8502) - * Fix failing bound statement after adding a collection (CASSANDRA-9411) * Fix counting cache serialization in request metrics (CASSANDRA-9466) * (cqlsh) Add LOGIN command to switch users (CASSANDRA-7212) * Clone SliceQueryFilter in AbstractReadCommand implementations (CASSANDRA-8940) http://git-wip-us.apache.org/repos/asf/cassandra/blob/fb1eaab4/src/java/org/apache/cassandra/io/compress/CompressionParameters.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/fb1eaab4/test/unit/org/apache/cassandra/cql3/CrcCheckChanceTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/CrcCheckChanceTest.java index f218c9d,0000000..bed3cdd mode 100644,000000..100644 --- a/test/unit/org/apache/cassandra/cql3/CrcCheckChanceTest.java +++ b/test/unit/org/apache/cassandra/cql3/CrcCheckChanceTest.java @@@ -1,157 -1,0 +1,159 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.cql3; + +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import junit.framework.Assert; +import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.db.ColumnFamilyStore; +import org.apache.cassandra.db.Keyspace; +import org.apache.cassandra.db.compaction.CompactionInterruptedException; +import org.apache.cassandra.db.compaction.CompactionManager; +import org.apache.cassandra.utils.FBUtilities; + +import org.junit.Test; + + +public class CrcCheckChanceTest extends CQLTester +{ + @Test + public void testChangingCrcCheckChance() throws Throwable + { + //Start with crc_check_chance of 99% + createTable("CREATE TABLE %s (p text, c text, v text, s text static, PRIMARY KEY (p, c)) WITH compression = {'sstable_compression': 'LZ4Compressor', 'crc_check_chance' : 0.99}"); + + execute("CREATE INDEX foo ON %s(v)"); + + execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1"); + execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2"); + execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2"); + + + ColumnFamilyStore cfs = Keyspace.open(CQLTester.KEYSPACE).getColumnFamilyStore(currentTable()); + ColumnFamilyStore indexCfs = cfs.indexManager.getIndexesBackedByCfs().iterator().next(); + cfs.forceBlockingFlush(); + + Assert.assertEquals(0.99, cfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals(0.99, cfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + Assert.assertEquals(0.99, indexCfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals(0.99, indexCfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + ++ //Test for stack overflow ++ cfs.setCrcCheckChance(0.99); + + assertRows(execute("SELECT * FROM %s WHERE p=?", "p1"), + row("p1", "k1", "sv1", "v1"), + row("p1", "k2", "sv1", "v2") + ); + + assertRows(execute("SELECT * FROM %s WHERE v=?", "v1"), + row("p1", "k1", "sv1", "v1") + ); + + + + //Write a few SSTables then Compact + + execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1"); + execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2"); + execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2"); + + cfs.forceBlockingFlush(); + + + execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1"); + execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2"); + execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2"); + + cfs.forceBlockingFlush(); + + execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1"); + execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2"); + execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2"); + + cfs.forceBlockingFlush(); + + cfs.forceMajorCompaction(); + + //Verify when we alter the value the live sstable readers hold the new one + alterTable("ALTER TABLE %s WITH compression = {'sstable_compression': 'LZ4Compressor', 'crc_check_chance': 0.01}"); + + Assert.assertEquals( 0.01, cfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals( 0.01, cfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + Assert.assertEquals( 0.01, indexCfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals( 0.01, indexCfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + + assertRows(execute("SELECT * FROM %s WHERE p=?", "p1"), + row("p1", "k1", "sv1", "v1"), + row("p1", "k2", "sv1", "v2") + ); + + assertRows(execute("SELECT * FROM %s WHERE v=?", "v1"), + row("p1", "k1", "sv1", "v1") + ); + + + //Verify the call used by JMX still works + cfs.setCrcCheckChance(0.03); + Assert.assertEquals( 0.03, cfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals( 0.03, cfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + Assert.assertEquals( 0.03, indexCfs.metadata.compressionParameters.getCrcCheckChance()); + Assert.assertEquals( 0.03, indexCfs.getSSTables().iterator().next().getCompressionMetadata().parameters.getCrcCheckChance()); + + } + + + @Test + public void testDropDuringCompaction() throws Throwable + { + CompactionManager.instance.disableAutoCompaction(); + + //Start with crc_check_chance of 99% + createTable("CREATE TABLE %s (p text, c text, v text, s text static, PRIMARY KEY (p, c)) WITH compression = {'sstable_compression': 'LZ4Compressor', 'crc_check_chance' : 0.99}"); + + ColumnFamilyStore cfs = Keyspace.open(CQLTester.KEYSPACE).getColumnFamilyStore(currentTable()); + + //Write a few SSTables then Compact, and drop + for (int i = 0; i < 100; i++) + { + execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1"); + execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2"); + execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2"); + + cfs.forceBlockingFlush(); + } + + DatabaseDescriptor.setCompactionThroughputMbPerSec(1); + List<Future<?>> futures = CompactionManager.instance.submitMaximal(cfs, CompactionManager.GC_ALL); + execute("DROP TABLE %s"); + + try + { + FBUtilities.waitOnFutures(futures); + } + catch (Throwable t) + { + if (!(t.getCause() instanceof ExecutionException) || !(t.getCause().getCause() instanceof CompactionInterruptedException)) + throw t; + } + } +} +