cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Disallow renaming a 2ndary indexed column
Date Wed, 26 Jun 2013 18:00:50 GMT
Updated Branches:
  refs/heads/trunk 6258c58cd -> 29232a88d


Disallow renaming a 2ndary indexed column

patch by slebresne; reviewed by iamaleksey for CASSANDRA-5705


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

Branch: refs/heads/trunk
Commit: 29232a88d174d331a982e5abc01b0d441ed1c248
Parents: 6258c58
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Jun 26 19:59:47 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Jun 26 20:00:41 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                          | 1 +
 src/java/org/apache/cassandra/config/CFMetaData.java | 6 ++++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/29232a88/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4973987..a79d2db 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -65,6 +65,7 @@
  * more pre-table creation property validation (CASSANDRA-5693)
  * Redesign repair messages (CASSANDRA-5426)
  * Fix ALTER RENAME post-5125 (CASSANDRA-5702)
+ * Disallow renaming a 2ndary indexed column (CASSANDRA-5705)
 
 
 1.2.7

http://git-wip-us.apache.org/repos/asf/cassandra/blob/29232a88/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 43d7297..6594d75 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -1794,7 +1794,13 @@ public final class CFMetaData
             throw new InvalidRequestException(String.format("Cannot rename column %s to %s
in table %s; another column of that name already exist", strFrom, strTo, cfName));
 
         if (def.type == ColumnDefinition.Type.REGULAR)
+        {
             throw new InvalidRequestException(String.format("Cannot rename non PRIMARY KEY
part %s", strFrom));
+        }
+        else if (def.isIndexed())
+        {
+            throw new InvalidRequestException(String.format("Cannot rename column %s because
it is secondary indexed", strFrom));
+        }
 
         ColumnDefinition newDef = def.cloneWithNewName(to);
         // don't call addColumnDefinition/removeColumnDefition because we want to avoid recomputing


Mime
View raw message