cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [08/10] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Mon, 11 Apr 2016 18:19:17 GMT
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/5dbeef3f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5dbeef3f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5dbeef3f

Branch: refs/heads/cassandra-3.0
Commit: 5dbeef3f51e61525c90de35c521142f7db340fe5
Parents: f0cd326 ab2b8a6
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Apr 11 19:16:03 2016 +0100
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Apr 11 19:16:39 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 conf/cassandra.yaml                             |  3 ++
 .../org/apache/cassandra/config/Config.java     |  1 +
 .../cassandra/config/DatabaseDescriptor.java    |  5 +++
 .../cql3/statements/BatchStatement.java         | 37 ++++++--------------
 5 files changed, 20 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dbeef3f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 8c40e63,419ed21..76c9d99
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -89,9 -42,12 +89,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: change default encoding to UTF-8 (CASSANDRA-11124)
  Merged from 2.1:
+  * Checking if an unlogged batch is local is inefficient (CASSANDRA-11529)
 - * Fix paging for COMPACT tables without clustering columns (CASSANDRA-11467)
 - * Add a -j parameter to scrub/cleanup/upgradesstables to state how
 -   many threads to use (CASSANDRA-11179)
 - * Backport CASSANDRA-10679 (CASSANDRA-9598)
 + * 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)
   * Avoid dropping message too quickly due to missing unit conversion (CASSANDRA-11302)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dbeef3f/conf/cassandra.yaml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dbeef3f/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dbeef3f/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dbeef3f/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
index 47396fb,76e389b..1c395a5
--- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
@@@ -32,12 -32,12 +32,10 @@@ import org.apache.cassandra.config.Colu
  import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.cql3.*;
  import org.apache.cassandra.db.*;
 -import org.apache.cassandra.db.composites.Composite;
 +import org.apache.cassandra.db.partitions.PartitionUpdate;
 +import org.apache.cassandra.db.rows.RowIterator;
- import org.apache.cassandra.dht.Range;
- import org.apache.cassandra.dht.Token;
  import org.apache.cassandra.exceptions.*;
 -import org.apache.cassandra.service.ClientState;
 -import org.apache.cassandra.service.ClientWarn;
 -import org.apache.cassandra.service.QueryState;
 -import org.apache.cassandra.service.StorageProxy;
 +import org.apache.cassandra.service.*;
  import org.apache.cassandra.tracing.Tracing;
  import org.apache.cassandra.transport.messages.ResultMessage;
  import org.apache.cassandra.utils.NoSpamLogger;
@@@ -69,16 -59,8 +67,16 @@@ public class BatchStatement implements 
      private final Attributes attrs;
      private final boolean hasConditions;
      private static final Logger logger = LoggerFactory.getLogger(BatchStatement.class);
 -    private static final String unloggedBatchWarning = "Unlogged batch covering {} partitions
detected against table{} {}. " +
 -                                                       "You should use a logged batch for
atomicity, or asynchronous writes for performance.";
 +
-     private static final String UNLOGGED_BATCH_WARNING = "Unlogged batch covering {} partition{}
detected " +
++    private static final String UNLOGGED_BATCH_WARNING = "Unlogged batch covering {} partitions
detected " +
 +                                                         "against table{} {}. You should
use a logged batch for " +
 +                                                         "atomicity, or asynchronous writes
for performance.";
 +
 +    private static final String LOGGED_BATCH_LOW_GCGS_WARNING = "Executing a LOGGED BATCH
on table{} {}, configured with a " +
 +                                                                "gc_grace_seconds of 0.
The gc_grace_seconds is used to TTL " +
 +                                                                "batchlog entries, so setting
gc_grace_seconds too low on " +
 +                                                                "tables involved in an atomic
batch might cause batchlog " +
 +                                                                "entries to expire before
being replayed.";
  
      /**
       * Creates a new BatchStatement from a list of statements and a
@@@ -292,35 -275,35 +290,31 @@@
          }
      }
  
 -    private void verifyBatchType(Collection<? extends IMutation> mutations)
 +    private void verifyBatchType(Iterable<PartitionUpdate> updates)
      {
 -        if (type != Type.LOGGED && mutations.size() > 1)
 +        if (!isLogged() && Iterables.size(updates) > 1)
          {
 -            Set<String> ksCfPairs = new HashSet<>();
 -            Set<ByteBuffer> keySet = new HashSet<>();
 +            Set<DecoratedKey> keySet = new HashSet<>();
 +            Set<String> tableNames = new HashSet<>();
  
-             Map<String, Collection<Range<Token>>> localTokensByKs = new
HashMap<>();
-             boolean localPartitionsOnly = true;
 -            for (IMutation im : mutations)
 +            for (PartitionUpdate update : updates)
              {
 -                keySet.add(im.key());
 +                keySet.add(update.partitionKey());
-                 tableNames.add(String.format("%s.%s", update.metadata().ksName, update.metadata().cfName));
  
-                 if (localPartitionsOnly)
-                     localPartitionsOnly &= isPartitionLocal(localTokensByKs, update);
 -                for (ColumnFamily cf : im.getColumnFamilies())
 -                    ksCfPairs.add(String.format("%s.%s", cf.metadata().ksName, cf.metadata().cfName));
++                tableNames.add(String.format("%s.%s", update.metadata().ksName, update.metadata().cfName));
              }
  
-             // CASSANDRA-9303: If we only have local mutations we do not warn
-             if (localPartitionsOnly)
-                 return;
- 
+             // 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, unloggedBatchWarning,
 -                                 keySet.size(), ksCfPairs.size() == 1 ? "" : "s", ksCfPairs);
 -
 -                ClientWarn.instance.warn(MessageFormatter.arrayFormat(unloggedBatchWarning,
 -                                                                  new Object[]{
 -                                                                              keySet.size(),
 -                                                                              ksCfPairs.size()
== 1 ? "" : "s",
 -                                                                              ksCfPairs
 -                                                                  }).getMessage());
 +
-             NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, 1, TimeUnit.MINUTES, UNLOGGED_BATCH_WARNING,
-                              keySet.size(), keySet.size() == 1 ? "" : "s",
-                              tableNames.size() == 1 ? "" : "s", tableNames);
++                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());
+             }
          }
      }
  


Mime
View raw message