Merge branch 'cassandra-3.0' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cb1a6347 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cb1a6347 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cb1a6347 Branch: refs/heads/trunk Commit: cb1a63474d37d9bf0525d4c5be7c30ddd2ec6965 Parents: c2acf47 5dbeef3 Author: Aleksey Yeschenko <[email protected]> Authored: Mon Apr 11 19:18:21 2016 +0100 Committer: Aleksey Yeschenko <[email protected]> Committed: Mon Apr 11 19:18:42 2016 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + conf/cassandra.yaml | 62 +++++++++++--------- .../org/apache/cassandra/config/Config.java | 1 + .../cassandra/config/DatabaseDescriptor.java | 5 ++ .../cql3/statements/BatchStatement.java | 39 ++++-------- 5 files changed, 51 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb1a6347/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index f399fd9,76c9d99..69ad7da --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -167,9 -89,9 +167,10 @@@ Merged from 2.2 * (cqlsh) Support utf-8/cp65001 encoding on Windows (CASSANDRA-11030) * Fix paging on DISTINCT queries repeats result when first row in partition changes (CASSANDRA-10010) + * (cqlsh) Support timezone conversion using pytz (CASSANDRA-10397) * cqlsh: change default encoding to UTF-8 (CASSANDRA-11124) Merged from 2.1: + * Checking if an unlogged batch is local is inefficient (CASSANDRA-11529) * Fix out-of-space error treatment in memtable flushing (CASSANDRA-11448). * Don't do defragmentation if reading from repaired sstables (CASSANDRA-10342) * Fix streaming_socket_timeout_in_ms not enforced (CASSANDRA-11286) http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb1a6347/conf/cassandra.yaml ---------------------------------------------------------------------- diff --cc conf/cassandra.yaml index 58bd1b6,f81c1e5..f9be453 --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@@ -649,18 -630,18 +649,6 @@@ snapshot_before_compaction: fals # lose data on truncation or drop. auto_snapshot: true --# When executing a scan, within or across a partition, we need to keep the --# tombstones seen in memory so we can return them to the coordinator, which --# will use them to make sure other replicas also know about the deleted rows. --# With workloads that generate a lot of tombstones, this can cause performance --# problems and even exaust the server heap. --# (http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets) --# Adjust the thresholds here if you understand the dangers and want to --# scan more tombstones anyway. These thresholds may also be adjusted at runtime --# using the StorageService mbean. --tombstone_warn_threshold: 1000 --tombstone_failure_threshold: 100000 -- # Granularity of the collation index of rows within a partition. # Increase if your rows are large, or if you have a very large # number of rows per partition. The competing goals are these: @@@ -672,14 -653,17 +660,6 @@@ # you can cache more hot rows column_index_size_in_kb: 64 -- --# Log WARN on any batch size exceeding this value. 5kb per batch by default. --# Caution should be taken on increasing the size of this threshold as it can lead to node instability. --batch_size_warn_threshold_in_kb: 5 -- --# Fail any batch exceeding this value. 50kb (10x warn threshold) by default. --batch_size_fail_threshold_in_kb: 50 - -# Log WARN on any batches not of type LOGGED than span across more partitions than this limit -unlogged_batch_across_partitions_warn_threshold: 10 -- # Number of simultaneous compactions to allow, NOT including # validation "compactions" for anti-entropy repair. Simultaneous # compactions can help preserve read performance in a mixed read/write @@@ -704,9 -688,9 +684,6 @@@ # of compaction, including validation compaction. compaction_throughput_mb_per_sec: 16 --# Log a warning when compacting partitions larger than this value --compaction_large_partition_warning_threshold_mb: 100 -- # When compacting, the replacement sstable(s) can be opened before they # are completely written, and used in place of the prior sstables for # any range that has been written. This helps to smoothly transfer reads @@@ -942,11 -921,11 +919,6 @@@ inter_dc_tcp_nodelay: fals tracetype_query_ttl: 86400 tracetype_repair_ttl: 604800 --# GC Pauses greater than gc_warn_threshold_in_ms will be logged at WARN level --# Adjust the threshold based on your application throughput requirement --# By default, Cassandra logs GC Pauses greater than 200 ms at INFO level --gc_warn_threshold_in_ms: 1000 -- # UDFs (user defined functions) are disabled by default. # As of Cassandra 3.0 there is a sandbox in place that should prevent execution of evil code. enable_user_defined_functions: false @@@ -963,32 -942,3 +935,66 @@@ enable_scripted_user_defined_functions # below their system default. The sysinternals 'clockres' tool can confirm your system's default # setting. windows_timer_interval: 1 + + +# Enables encrypting data at-rest (on disk). Different key providers can be plugged in, but the default reads from +# a JCE-style keystore. A single keystore can hold multiple keys, but the one referenced by +# the "key_alias" is the only key that will be used for encrypt opertaions; previously used keys +# can still (and should!) be in the keystore and will be used on decrypt operations +# (to handle the case of key rotation). +# +# It is strongly recommended to download and install Java Cryptography Extension (JCE) +# Unlimited Strength Jurisdiction Policy Files for your version of the JDK. +# (current link: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html) +# +# Currently, only the following file types are supported for transparent data encryption, although +# more are coming in future cassandra releases: commitlog, hints +transparent_data_encryption_options: + enabled: false + chunk_length_kb: 64 + cipher: AES/CBC/PKCS5Padding + key_alias: testing:1 + # CBC IV length for AES needs to be 16 bytes (which is also the default size) + # iv_length: 16 + key_provider: + - class_name: org.apache.cassandra.security.JKSKeyProvider + parameters: + - keystore: conf/.keystore + keystore_password: cassandra + store_type: JCEKS + key_password: cassandra + ++ ++##################### ++# SAFETY THRESHOLDS # ++##################### ++ ++# When executing a scan, within or across a partition, we need to keep the ++# tombstones seen in memory so we can return them to the coordinator, which ++# will use them to make sure other replicas also know about the deleted rows. ++# With workloads that generate a lot of tombstones, this can cause performance ++# problems and even exaust the server heap. ++# (http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets) ++# Adjust the thresholds here if you understand the dangers and want to ++# scan more tombstones anyway. These thresholds may also be adjusted at runtime ++# using the StorageService mbean. ++tombstone_warn_threshold: 1000 ++tombstone_failure_threshold: 100000 ++ ++# Log WARN on any batch size exceeding this value. 5kb per batch by default. ++# Caution should be taken on increasing the size of this threshold as it can lead to node instability. ++batch_size_warn_threshold_in_kb: 5 ++ ++# Fail any batch exceeding this value. 50kb (10x warn threshold) by default. ++batch_size_fail_threshold_in_kb: 50 ++ ++# Log WARN on any batches not of type LOGGED than span across more partitions than this limit ++unlogged_batch_across_partitions_warn_threshold: 10 ++ ++# Log a warning when compacting partitions larger than this value ++compaction_large_partition_warning_threshold_mb: 100 ++ ++# GC Pauses greater than gc_warn_threshold_in_ms will be logged at WARN level ++# Adjust the threshold based on your application throughput requirement ++# By default, Cassandra logs GC Pauses greater than 200 ms at INFO level ++gc_warn_threshold_in_ms: 1000 http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb1a6347/src/java/org/apache/cassandra/config/Config.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb1a6347/src/java/org/apache/cassandra/config/DatabaseDescriptor.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb1a6347/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/BatchStatement.java index eb69025,1c395a5..d151d04 --- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java @@@ -21,7 -21,7 +21,6 @@@ import java.nio.ByteBuffer import java.util.*; import java.util.concurrent.TimeUnit; --import com.google.common.base.Function; import com.google.common.collect.Iterables; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@@ -313,30 -297,24 +310,26 @@@ public class BatchStatement implements Set<DecoratedKey> keySet = new HashSet<>(); Set<String> tableNames = new HashSet<>(); - Map<String, Collection<Range<Token>>> localTokensByKs = new HashMap<>(); - boolean localPartitionsOnly = true; - for (PartitionUpdate update : updates) + for (IMutation mutation : mutations) { - keySet.add(update.partitionKey()); + for (PartitionUpdate update : mutation.getPartitionUpdates()) + { + keySet.add(update.partitionKey()); + - tableNames.add(String.format("%s.%s", update.metadata().ksName, update.metadata().cfName)); + tableNames.add(String.format("%s.%s", update.metadata().ksName, update.metadata().cfName)); + } - - if (localPartitionsOnly) - localPartitionsOnly &= isPartitionLocal(localTokensByKs, mutation); } - // CASSANDRA-9303: If we only have local mutations we do not warn - if (localPartitionsOnly) - return; - - NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, 1, TimeUnit.MINUTES, UNLOGGED_BATCH_WARNING, - keySet.size(), keySet.size() == 1 ? "" : "s", - tableNames.size() == 1 ? "" : "s", tableNames); + // CASSANDRA-11529: log only if we have more than a threshold of keys, this was also suggested in the + // original ticket that introduced this warning, CASSANDRA-9282 + if (keySet.size() > DatabaseDescriptor.getUnloggedBatchAcrossPartitionsWarnThreshold()) + { - + NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, 1, TimeUnit.MINUTES, UNLOGGED_BATCH_WARNING, + keySet.size(), tableNames.size() == 1 ? "" : "s", tableNames); - ClientWarn.instance.warn(MessageFormatter.arrayFormat(UNLOGGED_BATCH_WARNING, new Object[]{keySet.size(), keySet.size() == 1 ? "" : "s", + ClientWarn.instance.warn(MessageFormatter.arrayFormat(UNLOGGED_BATCH_WARNING, new Object[]{keySet.size(), tableNames.size() == 1 ? "" : "s", tableNames}).getMessage()); + } } }
