Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 0e272c233 -> 36ecc69cb


Forbid re-adding dropped counter columns

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-7831


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

Branch: refs/heads/cassandra-2.0
Commit: 36ecc69cbf3cc3734cf0602c60f101de95032a44
Parents: 0e272c2
Author: Aleksey Yeschenko <alek...@apache.org>
Authored: Thu Aug 28 16:30:23 2014 +0300
Committer: Aleksey Yeschenko <alek...@apache.org>
Committed: Thu Aug 28 16:31:07 2014 +0300

----------------------------------------------------------------------
 CHANGES.txt                                                      | 1 +
 .../apache/cassandra/cql3/statements/AlterTableStatement.java    | 4 ++++
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/36ecc69c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index abdd561..20874ac 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.11:
+ * Forbid re-adding dropped counter columns (CASSANDRA-7831)
  * Fix CFMetaData#isThriftCompatible() for PK-only tables (CASSANDRA-7832)
  * Always reject inequality on the partition key without token()
    (CASSANDRA-7722)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/36ecc69c/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java 
b/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
index dfcd601..698c8b8 100644
--- a/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
@@ -109,6 +109,10 @@ public class AlterTableStatement extends 
SchemaAlteringStatement
                     }
                 }
 
+                // Cannot re-add a dropped counter column. See #7831.
+                if (meta.getDefaultValidator().isCommutative() && 
meta.getDroppedColumns().containsKey(columnName.key))
+                    throw new InvalidRequestException(String.format("Cannot 
re-add previously dropped counter column %s", columnName));
+
                 AbstractType<?> type = validator.getType();
                 if (type instanceof CollectionType)
                 {

Reply via email to