You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2017/01/18 15:19:00 UTC

[4/4] cassandra git commit: Merge branch cassandra-3.11 into trunk

Merge branch cassandra-3.11 into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/369e7aa4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/369e7aa4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/369e7aa4

Branch: refs/heads/trunk
Commit: 369e7aa4c12e5960afafdf3790ee283a6dcf6566
Parents: 8c7ed28 d388289
Author: Benjamin Lerer <b....@gmail.com>
Authored: Wed Jan 18 16:09:36 2017 +0100
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Wed Jan 18 16:18:29 2017 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 NEWS.txt                                        |  27 ++--
 doc/cql3/CQL.textile                            |  14 +-
 doc/source/cql/changes.rst                      |   6 +
 doc/source/cql/ddl.rst                          |  52 +------
 doc/source/cql/types.rst                        |   5 +-
 pylib/cqlshlib/cql3handling.py                  |   6 +-
 .../org/apache/cassandra/config/CFMetaData.java |  29 +---
 .../apache/cassandra/cql3/QueryProcessor.java   |   2 +-
 .../cql3/statements/AlterTableStatement.java    |  86 +----------
 .../cql3/statements/AlterTypeStatement.java     |  36 +----
 .../apache/cassandra/cql3/ViewSchemaTest.java   |  76 ----------
 .../entities/FrozenCollectionsTest.java         |  42 ------
 .../cql3/validation/entities/TypeTest.java      |  32 -----
 .../cql3/validation/entities/UserTypesTest.java |   1 -
 .../cql3/validation/operations/AlterTest.java   | 144 +------------------
 .../cql3/validation/operations/UpdateTest.java  |  32 -----
 17 files changed, 44 insertions(+), 547 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 2935342,453445a..4614ff7
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,36 -1,4 +1,37 @@@
 +4.0
 + * Speed-up start-up sequence by avoiding un-needed flushes (CASSANDRA-13031)
 + * Use Caffeine (W-TinyLFU) for on-heap caches (CASSANDRA-10855)
 + * Thrift removal (CASSANDRA-11115)
 + * Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716)
 + * Add column definition kind to dropped columns in schema (CASSANDRA-12705)
 + * Add (automate) Nodetool Documentation (CASSANDRA-12672)
 + * Update bundled cqlsh python driver to 3.7.0 (CASSANDRA-12736)
 + * Reject invalid replication settings when creating or altering a keyspace (CASSANDRA-12681)
 + * Clean up the SSTableReader#getScanner API wrt removal of RateLimiter (CASSANDRA-12422)
 +
 +
 +3.12
 + * Use new token allocation for non bootstrap case as well (CASSANDRA-13080)
 + * Avoid byte-array copy when key cache is disabled (CASSANDRA-13084)
 + * More fixes to the TokenAllocator (CASSANDRA-12990)
 + * Require forceful decommission if number of nodes is less than replication factor (CASSANDRA-12510)
 + * Allow IN restrictions on column families with collections (CASSANDRA-12654)
 + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
 + * nodetool stopdaemon errors out (CASSANDRA-13030)
 + * Log message size in trace message in OutboundTcpConnection (CASSANDRA-13028)
 + * Add timeUnit Days for cassandra-stress (CASSANDRA-13029)
 + * Add mutation size and batch metrics (CASSANDRA-12649)
 + * Add method to get size of endpoints to TokenMetadata (CASSANDRA-12999)
 + * Fix primary index calculation for SASI (CASSANDRA-12910)
 + * Expose time spent waiting in thread pool queue (CASSANDRA-8398)
 + * Conditionally update index built status to avoid unnecessary flushes (CASSANDRA-12969)
 + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
 + * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946)
 + * Add support for arithmetic operators (CASSANDRA-11935)
 + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
 +
  3.10
++ * Remove ALTER TYPE support (CASSANDRA-12443)
   * Fix TestHintedHandoff.hintedhandoff_decom_test (CASSANDRA-13058)
   * Fixed query monitoring for range queries (CASSANDRA-13050)
   * Remove outboundBindAny configuration property (CASSANDRA-12673)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index e155768,985c6d4..1c4bfdc
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -13,44 -13,7 +13,29 @@@ restore snapshots created with the prev
  'sstableloader' tool. You can upgrade the file format of your snapshots
  using the provided 'sstableupgrade' tool.
  
 +4.0
 +===
 +
 +New features
 +------------
 +
 +Upgrading
 +---------
 +    - Cassandra 4.0 removed support for the deprecated Thrift interface. Amongst
 +      Tother things, this imply the removal of all yaml option related to thrift
 +      ('start_rpc', rpc_port, ...).
 +    - Cassandra 4.0 removed support for any pre-3.0 format. This means you
 +      cannot upgrade from a 2.x version to 4.0 directly, you have to upgrade to
 +      a 3.0.x/3.x version first (and run upgradesstable). In particular, this
 +      mean Cassandra 4.0 cannot load or read pre-3.0 sstables in any way: you
 +      will need to upgrade those sstable in 3.0.x/3.x first.
 +    - Cassandra will no longer allow invalid keyspace replication options, such
 +      as invalid datacenter names for NetworkTopologyStrategy. Operators MUST
 +      add new nodes to a datacenter before they can set set ALTER or CREATE
 +      keyspace replication policies using that datacenter. Existing keyspaces
 +      will continue to operate, but CREATE and ALTER will validate that all
 +      datacenters specified exist in the cluster. 
  
- 3.11
- ====
- 
- Upgrading
- ---------
-    - Specifying the default_time_to_live option when creating or altering a
-      materialized view was erroneously accepted (and ignored). It is now
-      properly rejected.
-    - Only Java and JavaScript are now supported UDF languages.
-      The sandbox in 3.0 already prevented the use of script languages except Java
-      and JavaScript.
-    - Compaction now correctly drops sstables out of CompactionTask when there
-      isn't enough disk space to perform the full compaction.  This should reduce
-      pending compaction tasks on systems with little remaining disk space.
- 
  3.10
  ====
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/doc/source/cql/changes.rst
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/doc/source/cql/ddl.rst
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/CFMetaData.java
index bc92af0,1d3bb3a..097f29d
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@@ -47,7 -47,7 +47,6 @@@ import org.apache.cassandra.cql3.statem
  import org.apache.cassandra.cql3.statements.CreateTableStatement;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
--import org.apache.cassandra.db.filter.ColumnFilter;
  import org.apache.cassandra.db.marshal.*;
  import org.apache.cassandra.dht.IPartitioner;
  import org.apache.cassandra.exceptions.ConfigurationException;
@@@ -88,12 -88,14 +87,12 @@@ public final class CFMetaDat
      private final boolean isSuper;
      private final boolean isCounter;
      private final boolean isView;
- 
      private final boolean isIndex;
  
-     public volatile ClusteringComparator comparator;  // bytes, long, timeuuid, utf8, etc. This is built directly from clusteringColumns
+     public final ClusteringComparator comparator;  // bytes, long, timeuuid, utf8, etc. This is built directly from clusteringColumns
      public final IPartitioner partitioner;            // partitioner the table uses
+     private final AbstractType<?> keyValidator;
  
 -    private final Serializers serializers;
 -
      // non-final, for now
      public volatile TableParams params = TableParams.DEFAULT;
  
@@@ -319,11 -322,10 +315,8 @@@
  
          this.columnMetadata = newColumnMetadata;
  
-         List<AbstractType<?>> keyTypes = extractTypes(partitionKeyColumns);
-         this.keyValidator = keyTypes.size() == 1 ? keyTypes.get(0) : CompositeType.getInstance(keyTypes);
- 
          if (isCompactTable())
              this.compactValueColumn = CompactTables.getCompactValueColumn(partitionColumns, isSuper());
 -
 -        this.allColumnFilter = ColumnFilter.all(this);
      }
  
      public Indexes getIndexes()
@@@ -760,10 -776,11 +753,8 @@@
  
          rebuild();
  
 -        // compaction thresholds are checked by ThriftValidation. We shouldn't be doing
 -        // validation on the apply path; it's too late for that.
 -
          params = cfm.params;
  
-         keyValidator = cfm.keyValidator;
- 
          if (!cfm.droppedColumns.isEmpty())
              droppedColumns = cfm.droppedColumns;
  
@@@ -790,10 -807,7 +781,7 @@@
              throw new ConfigurationException(String.format("Column family ID mismatch (found %s; expected %s)",
                                                             cfm.cfId, cfId));
          if (!cfm.flags.equals(flags))
 -            throw new ConfigurationException("types do not match.");
 +            throw new ConfigurationException(String.format("Column family type mismatch (found %s; expected %s)", cfm.flags, flags));
- 
-         if (!cfm.comparator.isCompatibleWith(comparator))
-             throw new ConfigurationException(String.format("Column family comparators do not match or are not compatible (found %s; expected %s).", cfm.comparator.toString(), comparator.toString()));
      }
  
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
index ea6a9d4,04f01a5..f2f0698
--- a/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
@@@ -29,8 -29,8 +29,6 @@@ import org.apache.cassandra.db.ColumnFa
  import org.apache.cassandra.db.Keyspace;
  import org.apache.cassandra.db.marshal.AbstractType;
  import org.apache.cassandra.db.marshal.CollectionType;
--import org.apache.cassandra.db.marshal.CounterColumnType;
--import org.apache.cassandra.db.marshal.ReversedType;
  import org.apache.cassandra.db.view.View;
  import org.apache.cassandra.exceptions.*;
  import org.apache.cassandra.schema.IndexMetadata;
@@@ -343,53 -311,6 +307,7 @@@ public class AlterTableStatement extend
          return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, keyspace(), columnFamily());
      }
  
-     private static void validateAlter(CFMetaData cfm, ColumnDefinition def, AbstractType<?> validatorType)
-     {
-         switch (def.kind)
-         {
-             case PARTITION_KEY:
-                 if (validatorType instanceof CounterColumnType)
-                     throw new InvalidRequestException(String.format("counter type is not supported for PRIMARY KEY part %s", def.name));
- 
-                 AbstractType<?> currentType = cfm.getKeyValidatorAsClusteringComparator().subtype(def.position());
-                 if (!validatorType.isValueCompatibleWith(currentType))
-                     throw new ConfigurationException(String.format("Cannot change %s from type %s to type %s: types are incompatible.",
-                                                                    def.name,
-                                                                    currentType.asCQL3Type(),
-                                                                    validatorType.asCQL3Type()));
-                 break;
-             case CLUSTERING:
-                 if (!cfm.isCQLTable())
-                     throw new InvalidRequestException(String.format("Cannot alter clustering column %s in a non-CQL3 table", def.name));
- 
-                 AbstractType<?> oldType = cfm.comparator.subtype(def.position());
-                 // Note that CFMetaData.validateCompatibility already validate the change we're about to do. However, the error message it
-                 // sends is a bit cryptic for a CQL3 user, so validating here for a sake of returning a better error message
-                 // Do note that we need isCompatibleWith here, not just isValueCompatibleWith.
-                 if (!validatorType.isCompatibleWith(oldType))
-                 {
-                     throw new ConfigurationException(String.format("Cannot change %s from type %s to type %s: types are not order-compatible.",
-                                                                    def.name,
-                                                                    oldType.asCQL3Type(),
-                                                                    validatorType.asCQL3Type()));
-                 }
-                 break;
-             case REGULAR:
-             case STATIC:
-                 // As above, we want a clear error message, but in this case it happens that  CFMetaData.validateCompatibility *does not*
-                 // validate this for historical reasons so it's doubtly important. Note that we only care about value compatibility
-                 // though since we won't compare values (except when there is an index, but that is validated by ColumnDefinition already).
-                 // TODO: we could clear out where validation is done and do it only once.
-                 if (!validatorType.isValueCompatibleWith(def.type))
-                     throw new ConfigurationException(String.format("Cannot change %s from type %s to type %s: types are incompatible.",
-                                                                    def.name,
-                                                                    def.type.asCQL3Type(),
-                                                                    validatorType.asCQL3Type()));
-                 break;
-         }
-     }
- 
 +    @Override
      public String toString()
      {
          return String.format("AlterTableStatement(name=%s, type=%s)",

http://git-wip-us.apache.org/repos/asf/cassandra/blob/369e7aa4/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
----------------------------------------------------------------------