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

Jeff Jirsa commented on CASSANDRA-13369:
----------------------------------------

*This is not a review*, just a quick glance. However:

{code}
+            // Create a keyspace
+            execute("CREATE KEYSPACE testABC WITH replication = {'class' : 
'NetworkTopologyStrategy', '" + DATA_CENTER + "' : 2}");
+
+            // try modifying the keyspace
+            assertInvalidThrow(SyntaxException.class, "CREATE KEYSPACE testABC 
WITH replication = {'class' : 'NetworkTopologyStrategy', '" + DATA_CENTER + "' 
: 2, '" + DATA_CENTER + "' : 3 }");
+            execute("ALTER KEYSPACE testABC WITH replication = {'class' : 
'NetworkTopologyStrategy', '" + DATA_CENTER + "' : 3}");
{code}

You're creating the keyspace, then your comment says modify, but the CQL query 
is another {{CREATE}}, which will definitely fail. You're checking for 
{{SyntaxException}}, so I suspect the test is doing the right thing, but it's a 
bit confusing. Would be better if that was {{ALTER}}

> If there are multiple values for a key, CQL grammar choses last value. This 
> should not be silent or should not be allowed.
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13369
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13369
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Nachiket Patil
>            Assignee: Nachiket Patil
>            Priority: Minor
>         Attachments: 3.X.diff, trunk.diff
>
>
> If through CQL, multiple values are specified for a key, grammar parses the 
> map and last value for the key wins. This behavior is bad.
> e.g. 
> {code}
> CREATE KEYSPACE Excalibur WITH REPLICATION = {'class': 
> 'NetworkTopologyStrategy', 'dc1': 2, 'dc1': 5};
> {code}
> Parsing this statement, 'dc1' gets RF = 5. This can be catastrophic, may even 
> result in loss of data. This behavior should not be silent or not be allowed 
> at all.  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to