cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrés de la Peña (JIRA) <>
Subject [jira] [Commented] (CASSANDRA-13385) Delegate utests index name creation to CQLTester.createIndex
Date Tue, 28 Mar 2017 19:40:41 GMT


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

There is a first draft of the patch:
The method {{CQLTester.createIndex}} only returns the generated index name if the query has
the form:
createIndex("CREATE CUSTOM INDEX %s ON %s(c)");
However, the method returns {{null}} if the index name is manually generated or not specified:
createIndex("CREATE CUSTOM INDEX my_index ON %s(c)");
createIndex("CREATE CUSTOM INDEX ON %s(c)");
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:
>             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

View raw message