[ 
https://issues.apache.org/jira/browse/CASSANDRA-9961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14791813#comment-14791813
 ] 

Stefania commented on CASSANDRA-9961:
-------------------------------------

We still have a small issue with updating the metadata when a view is dropped 
even if the pushed notification is now received [~aholmber]. It's just a matter 
of updating the table metadata in addition to the keyspace views. Also, the 
double {{;;}} only appears when describing a keyspace or a table, we need to 
move the semi-column from {{as_cql_query()}} to {{export_as_string()}}.

Something along the lines of this diff should fix it:

{code}
diff --git a/cassandra/metadata.py b/cassandra/metadata.py
index 6b5026e..6b9c896 100644
--- a/cassandra/metadata.py
+++ b/cassandra/metadata.py
@@ -688,9 +688,12 @@ class KeyspaceMetadata(object):
                 self.indexes.pop(index_name, None)
             for view_name in table_meta.views:
                 self.views.pop(view_name, None)
+            return
         # we can't tell table drops from views, so drop both
         # (name is unique among them, within a keyspace)
-        self.views.pop(table_name, None)
+        view_meta = self.views.pop(table_name, None)
+        if view_meta:
+            self.tables[view_meta.base_table_name].views.pop(table_name, None)
 
     def _add_view_metadata(self, view_metadata):
         try:
@@ -2429,10 +2432,10 @@ class MaterializedViewMetadata(object):
                "FROM %(keyspace)s.%(base_table)s%(sep)s" \
                "WHERE %(where_clause)s%(sep)s" \
                "PRIMARY KEY %(pk)s%(sep)s" \
-               "WITH %(properties)s;" % locals()
+               "WITH %(properties)s" % locals()
 
     def export_as_string(self):
-        return self.as_cql_query(formatted=True)
+        return self.as_cql_query(formatted=True) + ";"

{code}



> cqlsh should have DESCRIBE MATERIALIZED VIEW
> --------------------------------------------
>
>                 Key: CASSANDRA-9961
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9961
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Carl Yeksigian
>            Assignee: Stefania
>              Labels: client-impacting, materializedviews
>             Fix For: 3.0.0 rc1
>
>
> cqlsh doesn't currently produce describe output that can be used to recreate 
> a MV. Needs to add a new {{DESCRIBE MATERIALIZED VIEW}} command, and also add 
> to {{DESCRIBE KEYSPACE}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to