cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject [2/3] cassandra git commit: Merge branch cassandra-2.2 into cassandra-3.0
Date Thu, 12 Nov 2015 20:14:16 GMT
Merge branch cassandra-2.2 into cassandra-3.0

Conflicts:
	CHANGES.txt
	test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java


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

Branch: refs/heads/cassandra-3.1
Commit: 464f8f076878dd95ae1f77f96edca8e1cd3c5699
Parents: 9f056a9 b05fe4f
Author: blerer <benjamin.lerer@datastax.com>
Authored: Thu Nov 12 21:07:08 2015 +0100
Committer: blerer <benjamin.lerer@datastax.com>
Committed: Thu Nov 12 21:07:08 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 .../cassandra/db/marshal/SimpleDateType.java       |  2 +-
 .../cql3/validation/operations/AlterTest.java      | 17 +++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/464f8f07/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d554323,5705453..f00b36d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,52 -1,7 +1,53 @@@
 -2.2.4
 +3.0.1
 + * Keep the file open in trySkipCache (CASSANDRA-10669)
 + * Updated trigger example (CASSANDRA-10257)
 +Merged from 2.2:
+  * Fix SimpleDateType type compatibility (CASSANDRA-10027)
   * (Hadoop) fix splits calculation (CASSANDRA-10640)
   * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
 +Merged from 2.1:
 + * Add a nodetool command to refresh size_estimates (CASSANDRA-9579)
 + * Invalidate cache after stream receive task is completed (CASSANDRA-10341)
 + * Reject counter writes in CQLSSTableWriter (CASSANDRA-10258)
 + * Remove superfluous COUNTER_MUTATION stage mapping (CASSANDRA-10605)
 +
 +
 +3.0
 + * Fix AssertionError while flushing memtable due to materialized views
 +   incorrectly inserting empty rows (CASSANDRA-10614)
 + * Store UDA initcond as CQL literal in the schema table, instead of a blob (CASSANDRA-10650)
 + * Don't use -1 for the position of partition key in schema (CASSANDRA-10491)
 + * Fix distinct queries in mixed version cluster (CASSANDRA-10573)
 + * Skip sstable on clustering in names query (CASSANDRA-10571)
 + * Remove value skipping as it breaks read-repair (CASSANDRA-10655)
 + * Fix bootstrapping with MVs (CASSANDRA-10621)
 + * Make sure EACH_QUORUM reads are using NTS (CASSANDRA-10584)
 + * Fix MV replica filtering for non-NetworkTopologyStrategy (CASSANDRA-10634)
 + * (Hadoop) fix CIF describeSplits() not handling 0 size estimates (CASSANDRA-10600)
 + * Fix reading of legacy sstables (CASSANDRA-10590)
 + * Use CQL type names in schema metadata tables (CASSANDRA-10365)
 + * Guard batchlog replay against integer division by zero (CASSANDRA-9223)
 + * Fix bug when adding a column to thrift with the same name than a primary key (CASSANDRA-10608)
 + * Add client address argument to IAuthenticator::newSaslNegotiator (CASSANDRA-8068)
 + * Fix implementation of LegacyLayout.LegacyBoundComparator (CASSANDRA-10602)
 + * Don't use 'names query' read path for counters (CASSANDRA-10572)
 + * Fix backward compatibility for counters (CASSANDRA-10470)
 + * Remove memory_allocator paramter from cassandra.yaml (CASSANDRA-10581,10628)
 + * Execute the metadata reload task of all registered indexes on CFS::reload (CASSANDRA-10604)
 + * Fix thrift cas operations with defined columns (CASSANDRA-10576)
 + * Fix PartitionUpdate.operationCount()for updates with static column operations (CASSANDRA-10606)
 + * Fix thrift get() queries with defined columns (CASSANDRA-10586)
 + * Fix marking of indexes as built and removed (CASSANDRA-10601)
 + * Skip initialization of non-registered 2i instances, remove Index::getIndexName (CASSANDRA-10595)
 + * Fix batches on multiple tables (CASSANDRA-10554)
 + * Ensure compaction options are validated when updating KeyspaceMetadata (CASSANDRA-10569)
 + * Flatten Iterator Transformation Hierarchy (CASSANDRA-9975)
 + * Remove token generator (CASSANDRA-5261)
 + * RolesCache should not be created for any authenticator that does not requireAuthentication
(CASSANDRA-10562)
 + * Fix LogTransaction checking only a single directory for files (CASSANDRA-10421)
 + * Fix handling of range tombstones when reading old format sstables (CASSANDRA-10360)
 + * Aggregate with Initial Condition fails with C* 3.0 (CASSANDRA-10367)
 +Merged from 2.2:
   * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
   * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
   * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/464f8f07/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/464f8f07/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
index a56ccc9,566c0ea..2451c48
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
@@@ -208,95 -201,20 +208,112 @@@ public class AlterTest extends CQLTeste
          }
      }
  
 +    @Test
 +    public void testAlterTableWithCompression() throws Throwable
 +    {
 +        createTable("CREATE TABLE %s (a text, b int, c int, primary key (a, b))");
 +
 +        assertRows(execute(format("SELECT compression FROM %s.%s WHERE keyspace_name = ?
and table_name = ?;",
 +                                  SchemaKeyspace.NAME,
 +                                  SchemaKeyspace.TABLES),
 +                           KEYSPACE,
 +                           currentTable()),
 +                   row(map("chunk_length_in_kb", "64", "class", "org.apache.cassandra.io.compress.LZ4Compressor")));
 +
 +        execute("ALTER TABLE %s WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb'
: 32 };");
 +
 +        assertRows(execute(format("SELECT compression FROM %s.%s WHERE keyspace_name = ?
and table_name = ?;",
 +                                  SchemaKeyspace.NAME,
 +                                  SchemaKeyspace.TABLES),
 +                           KEYSPACE,
 +                           currentTable()),
 +                   row(map("chunk_length_in_kb", "32", "class", "org.apache.cassandra.io.compress.SnappyCompressor")));
 +
 +        execute("ALTER TABLE %s WITH compression = { 'sstable_compression' : 'LZ4Compressor',
'chunk_length_kb' : 64 };");
 +
 +        assertRows(execute(format("SELECT compression FROM %s.%s WHERE keyspace_name = ?
and table_name = ?;",
 +                                  SchemaKeyspace.NAME,
 +                                  SchemaKeyspace.TABLES),
 +                           KEYSPACE,
 +                           currentTable()),
 +                   row(map("chunk_length_in_kb", "64", "class", "org.apache.cassandra.io.compress.LZ4Compressor")));
 +
 +        execute("ALTER TABLE %s WITH compression = { 'sstable_compression' : '', 'chunk_length_kb'
: 32 };");
 +
 +        assertRows(execute(format("SELECT compression FROM %s.%s WHERE keyspace_name = ?
and table_name = ?;",
 +                                  SchemaKeyspace.NAME,
 +                                  SchemaKeyspace.TABLES),
 +                           KEYSPACE,
 +                           currentTable()),
 +                   row(map("enabled", "false")));
 +
 +        execute("ALTER TABLE %s WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb'
: 32 };");
 +        execute("ALTER TABLE %s WITH compression = { 'enabled' : 'false'};");
 +
 +        assertRows(execute(format("SELECT compression FROM %s.%s WHERE keyspace_name = ?
and table_name = ?;",
 +                                  SchemaKeyspace.NAME,
 +                                  SchemaKeyspace.TABLES),
 +                           KEYSPACE,
 +                           currentTable()),
 +                   row(map("enabled", "false")));
 +
 +        assertThrowsConfigurationException("Missing sub-option 'class' for the 'compression'
option.",
 +                                           "ALTER TABLE %s WITH  compression = {'chunk_length_in_kb'
: 32};");
 +
 +        assertThrowsConfigurationException("The 'class' option must not be empty. To disable
compression use 'enabled' : false",
 +                                           "ALTER TABLE %s WITH  compression = { 'class'
: ''};");
 +
 +        assertThrowsConfigurationException("If the 'enabled' option is set to false no other
options must be specified",
 +                                           "ALTER TABLE %s WITH compression = { 'enabled'
: 'false', 'class' : 'SnappyCompressor'};");
 +
 +        assertThrowsConfigurationException("The 'sstable_compression' option must not be
used if the compression algorithm is already specified by the 'class' option",
 +                                           "ALTER TABLE %s WITH compression = { 'sstable_compression'
: 'SnappyCompressor', 'class' : 'SnappyCompressor'};");
 +
 +        assertThrowsConfigurationException("The 'chunk_length_kb' option must not be used
if the chunk length is already specified by the 'chunk_length_in_kb' option",
 +                                           "ALTER TABLE %s WITH compression = { 'class'
: 'SnappyCompressor', 'chunk_length_kb' : 32 , 'chunk_length_in_kb' : 32 };");
 +    }
 +
 +    @Test
 +    public void testAlterType() throws Throwable
 +    {
 +        createTable("CREATE TABLE %s (id text PRIMARY KEY, content text);");
 +        alterTable("ALTER TABLE %s ALTER content TYPE blob");
 +
 +        createTable("CREATE TABLE %s (pk int, ck text, value blob, PRIMARY KEY (pk, ck))
WITH CLUSTERING ORDER BY (ck DESC)");
 +        alterTable("ALTER TABLE %s ALTER ck TYPE blob");
 +
 +        createTable("CREATE TABLE %s (pk int, ck int, value blob, PRIMARY KEY (pk, ck))");
 +        assertThrowsConfigurationException("Cannot change value from type blob to type text:
types are incompatible.",
 +                                           "ALTER TABLE %s ALTER value TYPE TEXT;");
 +    }
 +
+     /**
+      * tests CASSANDRA-10027
+      */
+     @Test
+     public void testAlterColumnTypeToDate() throws Throwable
+     {
+         createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);");
+         execute("INSERT INTO %s (key, c1) VALUES (1,1);");
+         execute("ALTER TABLE %s ALTER c1 TYPE date;");
+         assertRows(execute("SELECT * FROM %s"), row(1, 1));
+ 
+         createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);");
+         execute("INSERT INTO %s (key, c1) VALUES (1,1);");
+         assertInvalidMessage("Cannot change c1 from type varint to type date: types are
incompatible.",
+                              "ALTER TABLE %s ALTER c1 TYPE date;");
+     }
++
 +    private void assertThrowsConfigurationException(String errorMsg, String alterStmt) throws
Throwable
 +    {
 +        try
 +        {
 +            execute(alterStmt);
 +            Assert.fail("Query should be invalid but no error was thrown. Query is: " +
alterStmt);
 +        }
 +        catch (ConfigurationException e)
 +        {
 +            assertEquals(errorMsg, e.getMessage());
 +        }
 +    }
  }


Mime
View raw message