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 2015/11/12 21:18:17 UTC
[1/4] cassandra git commit: Fix SimpleDateType type compatibility
Repository: cassandra
Updated Branches:
refs/heads/trunk 7fcf14faa -> 0781bccc9
Fix SimpleDateType type compatibility
patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b05fe4ff
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b05fe4ff
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b05fe4ff
Branch: refs/heads/trunk
Commit: b05fe4ffee8f1c457a79013c2ddc88abcdadc6bb
Parents: 84d4488
Author: blerer <be...@datastax.com>
Authored: Thu Nov 12 20:53:42 2015 +0100
Committer: blerer <be...@datastax.com>
Committed: Thu Nov 12 20:53:42 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/b05fe4ff/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9c834f3..5705453 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.4
+ * Fix SimpleDateType type compatibility (CASSANDRA-10027)
* (Hadoop) fix splits calculation (CASSANDRA-10640)
* (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
* (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java
index 747709e..6e435ee 100644
--- a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java
+++ b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java
@@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType<Integer>
@Override
public boolean isValueCompatibleWithInternal(AbstractType<?> otherType)
{
- return this == otherType || otherType == IntegerType.instance;
+ return this == otherType || otherType == Int32Type.instance;
}
public Term fromJSONObject(Object parsed) throws MarshalException
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
index 95380f4..566c0ea 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java
@@ -200,4 +200,21 @@ public class AlterTest extends CQLTester
assertInvalidSyntaxMessage("no viable alternative at input 'WITH'", stmt);
}
}
+
+ /**
+ * 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;");
+ }
}
[4/4] cassandra git commit: Merge branch cassandra-3.1 into trunk
Posted by bl...@apache.org.
Merge branch cassandra-3.1 into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0781bccc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0781bccc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0781bccc
Branch: refs/heads/trunk
Commit: 0781bccc92ad0204425c9515564bdacee0942439
Parents: 7fcf14f 6688911
Author: blerer <be...@datastax.com>
Authored: Thu Nov 12 21:14:45 2015 +0100
Committer: blerer <be...@datastax.com>
Committed: Thu Nov 12 21:14:59 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/0781bccc/CHANGES.txt
----------------------------------------------------------------------
[2/4] cassandra git commit: Merge branch cassandra-2.2 into
cassandra-3.0
Posted by bl...@apache.org.
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/trunk
Commit: 464f8f076878dd95ae1f77f96edca8e1cd3c5699
Parents: 9f056a9 b05fe4f
Author: blerer <be...@datastax.com>
Authored: Thu Nov 12 21:07:08 2015 +0100
Committer: blerer <be...@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());
+ }
+ }
}
[3/4] cassandra git commit: Merge branch cassandra-3.0 into
cassandra-3.1
Posted by bl...@apache.org.
Merge branch cassandra-3.0 into cassandra-3.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6688911f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6688911f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6688911f
Branch: refs/heads/trunk
Commit: 6688911f4a484ac2472fa3179f10358905cb9af8
Parents: e11bd0f 464f8f0
Author: blerer <be...@datastax.com>
Authored: Thu Nov 12 21:13:12 2015 +0100
Committer: blerer <be...@datastax.com>
Committed: Thu Nov 12 21:13:29 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/6688911f/CHANGES.txt
----------------------------------------------------------------------