cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-11442) `IF NOT EXISTS` doesn't work for `CREATE INDEX` queries when index name is not specified
Date Sat, 26 Mar 2016 19:30:25 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-11442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alex Petrov updated CASSANDRA-11442:
------------------------------------
    Description: 
`IF NOT EXISTS` doesn't work for `CREATE INDEX` queries when index name is not specified.
So executing {{CREATE INDEX IF NOT EXISTS ON %s(c)}} twice would cause

{code}
Caused by: org.apache.cassandra.exceptions.InvalidRequestException: Index table_0_c_idx_1
is a duplicate of existing index table_0_c_idx
	at org.apache.cassandra.cql3.statements.RequestValidations.invalidRequest(RequestValidations.java:199)
	at org.apache.cassandra.cql3.statements.RequestValidations.checkTrue(RequestValidations.java:63)
	at org.apache.cassandra.cql3.statements.RequestValidations.checkFalse(RequestValidations.java:111)
	at org.apache.cassandra.cql3.statements.CreateIndexStatement.announceMigration(CreateIndexStatement.java:225)
	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.executeInternal(SchemaAlteringStatement.java:120)
	at org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:637)
	... 29 more
{code}

Patch is attached. 

For convenience, I've created 

  was:
`IF NOT EXISTS` doesn't work for `CREATE INDEX` queries when index name is not specified.
So executing {{CREATE INDEX IF NOT EXISTS ON %s(c)}} twice would cause

{code}
Caused by: org.apache.cassandra.exceptions.InvalidRequestException: Index table_0_c_idx_1
is a duplicate of existing index table_0_c_idx
	at org.apache.cassandra.cql3.statements.RequestValidations.invalidRequest(RequestValidations.java:199)
	at org.apache.cassandra.cql3.statements.RequestValidations.checkTrue(RequestValidations.java:63)
	at org.apache.cassandra.cql3.statements.RequestValidations.checkFalse(RequestValidations.java:111)
	at org.apache.cassandra.cql3.statements.CreateIndexStatement.announceMigration(CreateIndexStatement.java:225)
	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.executeInternal(SchemaAlteringStatement.java:120)
	at org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:637)
	... 29 more
{code}

Patch is attached.


> `IF NOT EXISTS` doesn't work for `CREATE INDEX` queries when index name is not specified
> ----------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-11442
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11442
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Alex Petrov
>            Assignee: Alex Petrov
>            Priority: Trivial
>             Fix For: 3.x
>
>         Attachments: 0001-Make-IF-NOT-EXISTS-clause-work-on-index-creation-whe.patch
>
>
> `IF NOT EXISTS` doesn't work for `CREATE INDEX` queries when index name is not specified.
So executing {{CREATE INDEX IF NOT EXISTS ON %s(c)}} twice would cause
> {code}
> Caused by: org.apache.cassandra.exceptions.InvalidRequestException: Index table_0_c_idx_1
is a duplicate of existing index table_0_c_idx
> 	at org.apache.cassandra.cql3.statements.RequestValidations.invalidRequest(RequestValidations.java:199)
> 	at org.apache.cassandra.cql3.statements.RequestValidations.checkTrue(RequestValidations.java:63)
> 	at org.apache.cassandra.cql3.statements.RequestValidations.checkFalse(RequestValidations.java:111)
> 	at org.apache.cassandra.cql3.statements.CreateIndexStatement.announceMigration(CreateIndexStatement.java:225)
> 	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.executeInternal(SchemaAlteringStatement.java:120)
> 	at org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:637)
> 	... 29 more
> {code}
> Patch is attached. 
> For convenience, I've created 



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

Mime
View raw message