Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11136 SASI index options validation
  3. CASSANDRA-11129

[SASI Pre-QA] Index mode validation throws exception but do not cleanup index meta data

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 3.4
    • Component/s: Legacy/CQL
    • Labels:
      None
    • Environment:

      Tested from build CASSANDRA-11067

      Description

      Tested from build CASSANDRA-11067

      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">
      
      

      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:

      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">
      

      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...

        Attachments

          Activity

            People

            • Assignee:
              xedin Pavel Yaskevich
              Reporter:
              doanduyhai DOAN DuyHai
              Authors:
              Pavel Yaskevich
              Reviewers:
              Sam Tunnicliffe
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: