[
https://issues.apache.org/jira/browse/CASSANDRA-13385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15960462#comment-15960462
]
Benjamin Lerer commented on CASSANDRA-13385:
--------------------------------------------
I believe that we cannot really deal with indexes in the same way as with
tables, as we might have multiple indexes on one table. Keeping a current index
does not really make sense to me.
I would be in favor of having always {{createIndex}} returning the name of the
index even if it has been specified and having an extra mehod for droping the
index which takes as extra parameter the index name.
This will allow us to do:
{code}
String indexName = createIndex("CREATE INDEX ON %s(c)");
...
dropIndex("DROP INDEX %s", indexName);
{code}
I also do not think that we should drop the indexes explicitly as they are
dropped when the tables are.
> 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)