cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject cassandra git commit: Push correct protocol notification for DROP INDEX
Date Fri, 15 May 2015 14:23:25 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 f4ec535db -> b2a2d4635


Push correct protocol notification for DROP INDEX

patch by Carl Yeksigian; reviewed by Sam Tunnicliffe for CASSANDRA-9310


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

Branch: refs/heads/cassandra-2.0
Commit: b2a2d46352d2dcd57cef968a8cd4a2189bea32ce
Parents: f4ec535
Author: Carl Yeksigian <carl@apache.org>
Authored: Tue May 12 18:13:11 2015 -0400
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Fri May 15 17:20:34 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../cql3/statements/DropIndexStatement.java     | 24 ++++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b2a2d463/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cee28bc..c3e84db 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,8 @@
 2.0.16:
+ * Push correct protocol notification for DROP INDEX (CASSANDRA-9310)
  * token-generator - generated tokens too long (CASSANDRA-9300)
 
+
 2.0.15:
  * Fix counting of tombstones for TombstoneOverwhelmingException (CASSANDRA-9299)
  * Fix ReconnectableSnitch reconnecting to peers during upgrade (CASSANDRA-6702)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b2a2d463/src/java/org/apache/cassandra/cql3/statements/DropIndexStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/DropIndexStatement.java b/src/java/org/apache/cassandra/cql3/statements/DropIndexStatement.java
index b2e8dde..c421c09 100644
--- a/src/java/org/apache/cassandra/cql3/statements/DropIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/DropIndexStatement.java
@@ -33,6 +33,9 @@ public class DropIndexStatement extends SchemaAlteringStatement
     public final String indexName;
     public final boolean ifExists;
 
+    // initialized in announceMigration()
+    private String indexedCF;
+
     public DropIndexStatement(String indexName, boolean ifExists)
     {
         super(new CFName());
@@ -40,14 +43,20 @@ public class DropIndexStatement extends SchemaAlteringStatement
         this.ifExists = ifExists;
     }
 
-    // We don't override CFStatement#columnFamily as this'd change the
-    // protocol for returned events when we drop an index. We need it
-    // to return null so that SchemaMigrations remain a keyspace,
-    // rather than table, level event (see SchemaAlteringStatement#execute).
-    public String getColumnFamily() throws InvalidRequestException
+    public String columnFamily()
     {
-        CFMetaData cfm = findIndexedCF();
-        return cfm == null ? null : cfm.cfName;
+        if (indexedCF != null)
+            return indexedCF;
+
+        try
+        {
+            CFMetaData cfm = findIndexedCF();
+            return cfm == null ? null : cfm.cfName;
+        }
+        catch (InvalidRequestException ire)
+        {
+            throw new RuntimeException(ire);
+        }
     }
 
     public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
@@ -77,6 +86,7 @@ public class DropIndexStatement extends SchemaAlteringStatement
             return false;
 
         CFMetaData updatedCfm = updateCFMetadata(cfm);
+        indexedCF = updatedCfm.cfName;
         MigrationManager.announceColumnFamilyUpdate(updatedCfm, false);
         return true;
     }


Mime
View raw message