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 Tue, 28 Mar 2017 19:40:41 GMT

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

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

There is a first draft of the 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/]|
The method {{CQLTester.createIndex}} only returns the generated index name if the query has
the form:
{code}
createIndex("CREATE CUSTOM INDEX %s ON %s(c)");
{code}
However, the method returns {{null}} if the index name is manually generated or not specified:
{code}
createIndex("CREATE CUSTOM INDEX my_index ON %s(c)");
createIndex("CREATE CUSTOM INDEX ON %s(c)");
{code}
We may consider if it is a good idea to have dedicated methods for each case, such as {{createNamedIndex}}
or something similar.

The method {{CQLTester.dropIndex}} has been modified in the same way.

The patch also updates some tests likely to produce the race condition.


> 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