cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrés de la Peña (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-13385) Delegate utests index name creation to CQLTester.createIndex
Date Mon, 10 Apr 2017 10:20:42 GMT

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

Andrés de la Peña commented on CASSANDRA-13385:
-----------------------------------------------

Thanks for the valuable input, indeed it is a better idea to always return the index name.
Here is the new patch:

||[trunk|https://github.com/apache/cassandra/compare/trunk...adelapena:13385-trunk]|[utests|http://cassci.datastax.com/view/Dev/view/adelapena/job/adelapena-13385-trunk-testall/]|[dtests|http://cassci.datastax.com/view/Dev/view/adelapena/job/adelapena-13385-trunk-dtest/]|

{{createIndex}} parses the formatted query to retrieve the specified index name and, if it
has not been specified, it uses [{{Indexes.getAvailableIndexName}}|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/Indexes.java#L200]
to get the index name that the query execution is going to generate.
The {{CREATE INDEX}} query is parsed with a regular expression that is quite long due to the
number of cases:
{code}
CREATE INDEX ON table_0;
CREATE INDEX ON keyspace.table_0;
CREATE INDEX ON "keyspace".table_0;
CREATE INDEX ON keyspace."table_0";
CREATE INDEX idx_0 ON table_0;
CREATE INDEX table_0(c);
CREATE INDEX idx_0 ON table_0 (c);
CREATE INDEX idx_0 ON table_0( "c");
CREATE INDEX idx_0 ON table_0( keys (c);
CREATE INDEX idx_0 ON table_0( values (c);
CREATE INDEX IF NOT EXISTS idx_0 ON table_0(values(c);
CREATE CUSTOM INDEX idx_0 ON table_0 USING 'com.my' WITH OPTIONS = {'c':'(c)'};
{code}
Please let me know what do you think.

> Delegate utests index name creation to CQLTester.createIndex
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-13385
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13385
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Testing
>            Reporter: Andrés de la Peña
>            Assignee: Andrés de la Peña
>              Labels: cql, unit-test
>
> Currently, many unit tests rely on {{CQLTester.createIndex}} to create indexes. The index
name should be specified by the test itself, for example:
> {code}
> createIndex("CREATE CUSTOM INDEX myindex ON %s(c) USING 'org.apache.cassandra.index.internal.CustomCassandraIndex'");
> {code}
> Two different tests using the same index name can produce racy {{Index myindex already
exists}} errors due to the asynchronicity of {{CQLTester.afterTest}} cleanup methods. 
> It would be nice to modify {{CQLTester.createIndex}} to make it generate its own index
names, as it is done by {{CQLTester.createTable}}:
> {code}
> createIndex("CREATE CUSTOM INDEX %s ON %s(c) USING 'org.apache.cassandra.index.internal.CustomCassandraIndex'");
> {code}



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

Mime
View raw message