DOAN DuyHai created CASSANDRA-11129:
---------------------------------------

             Summary: [SASI Pre-QA] Index mode validation throws exception but 
do not cleanup index meta data
                 Key: CASSANDRA-11129
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11129
             Project: Cassandra
          Issue Type: Bug
          Components: CQL
            Reporter: DOAN DuyHai


Tested from build 
[CASSANDRA-11067|https://issues.apache.org/jira/browse/CASSANDRA-11067]

{code:sql}
CREATE KEYSPACE music WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '1'}  AND durable_writes = true;

CREATE TABLE music.albums (
    id int PRIMARY KEY,
    title text
);

cqlsh:music> CREATE CUSTOM INDEX IF NOT EXISTS ON music.albums(title) USING 
'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { 'mode':'NORMAL'};
ServerError: <ErrorMessage code=0000 [Server error] 
message="java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException">

{code}

 The error message is useless, by looking into the 
/var/log/cassandra/system.log message, the true error message is:
*Caused by: java.lang.IllegalArgumentException: No enum constant 
org.apache.cassandra.index.sasi.disk.OnDiskIndexBuilder.Mode.NORMAL*
        *at java.lang.Enum.valueOf(Enum.java:238) ~[na:1.8.0_45]*

 But worse, even the index creation fails, its metadata is not cleaned up so 
that further attempt to create an index on the same column using the correct 
mode also fails:

{code:sql}
cqlsh:music> CREATE CUSTOM INDEX IF NOT EXISTS ON music.albums(title) USING 
'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { 'mode':'PREFIX'};
ServerError: <ErrorMessage code=0000 [Server error] 
message="java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException">
{code}

 The only word-around is to drop the index. The index is not displayed by 
*DESCRIBE TABLE albums*. It only appears in the *system_schema.indexes* table...



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

Reply via email to