You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/11/18 17:34:23 UTC
[2/7] git commit: Disallow updating CQL3 tables from thrift
Disallow updating CQL3 tables from thrift
patch by slebresne; reviewed by jbellis for CASSANDRA-6370
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/34645c37
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/34645c37
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/34645c37
Branch: refs/heads/trunk
Commit: 34645c37d1e47b60cb20d3e3cd0e0376e8f92ae5
Parents: a301ea1
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Mon Nov 18 17:16:11 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Mon Nov 18 17:16:11 2013 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 9 +++++++++
src/java/org/apache/cassandra/thrift/CassandraServer.java | 3 +++
3 files changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/34645c37/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a438f15..29e87d8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
* Fix AssertionError when doing set element deletion (CASSANDRA-6341)
* Make CL code for the native protocol match the one in C* 2.0
(CASSANDRA-6347)
+ * Disallow altering CQL3 table from thrift (CASSANDRA-6370)
1.2.11
http://git-wip-us.apache.org/repos/asf/cassandra/blob/34645c37/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index d803f02..915729a 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -14,6 +14,15 @@ restore snapshots created with the previous major version using the
using the provided 'sstableupgrade' tool.
+1.2.12
+======
+
+Upgrading
+---------
+ - Altering CQL3 tables from Thrift is now rejected as this had the
+ potential of corrupting the schema. You should use cqlsh otherwise.
+
+
1.2.11
======
http://git-wip-us.apache.org/repos/asf/cassandra/blob/34645c37/src/java/org/apache/cassandra/thrift/CassandraServer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java
index 9063be1..5b9fbfd 100644
--- a/src/java/org/apache/cassandra/thrift/CassandraServer.java
+++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java
@@ -1407,6 +1407,9 @@ public class CassandraServer implements Cassandra.Iface
if (oldCfm == null)
throw new InvalidRequestException("Could not find column family definition to modify.");
+ if (!oldCfm.isThriftIncompatible())
+ throw new InvalidRequestException("Cannot modify CQL3 table " + oldCfm.cfName + " as it may break the schema. You should use cqlsh to modify CQL3 tables instead.");
+
state().hasColumnFamilyAccess(cf_def.keyspace, cf_def.name, Permission.ALTER);
CFMetaData.applyImplicitDefaults(cf_def);