Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-12378

Creating SASI index on clustering column in presence of static column breaks writes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Urgent
    • Resolution: Fixed
    • Fix Version/s: 3.10
    • Component/s: Feature/SASI
    • Labels:
      None
    • Severity:
      Critical

      Description

      Steps to reproduce:

      String simpleTable = "simple_table";
      QueryProcessor.executeOnceInternal(String.format("CREATE TABLE IF NOT EXISTS %s.%s (pk int, ck1 int, ck2 int, s1 int static, reg1 int, PRIMARY KEY (pk, ck1));", KS_NAME, simpleTable));
      QueryProcessor.executeOnceInternal(String.format("CREATE CUSTOM INDEX ON %s.%s (ck1) USING 'org.apache.cassandra.index.sasi.SASIIndex';", KS_NAME, simpleTable));
      
      QueryProcessor.executeOnceInternal(String.format("INSERT INTO %s.%s (pk, ck1, ck2, s1, reg1) VALUES (1,1,1,1,1);", KS_NAME, simpleTable));
      
      ERROR [MutationStage-2] 2016-08-04 09:59:08,054 StorageProxy.java:1351 - Failed to apply mutation locally : {}
      java.lang.RuntimeException: 0 for ks: test, table: sasi
              at org.apache.cassandra.db.ColumnFamilyStore.apply(ColumnFamilyStore.java:1371) ~[main/:na]
              at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:555) ~[main/:na]
              at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:425) ~[main/:na]
              at org.apache.cassandra.db.Mutation.applyFuture(Mutation.java:215) ~[main/:na]
              at org.apache.cassandra.db.Mutation.apply(Mutation.java:227) ~[main/:na]
              at org.apache.cassandra.db.Mutation.apply(Mutation.java:241) ~[main/:na]
              at org.apache.cassandra.service.StorageProxy$8.runMayThrow(StorageProxy.java:1345) ~[main/:na]
              at org.apache.cassandra.service.StorageProxy$LocalMutationRunnable.run(StorageProxy.java:2520) [main/:na]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_91]
              at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) [main/:na]
              at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:134) [main/:na]
              at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [main/:na]
              at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
              at org.apache.cassandra.db.AbstractBufferClusteringPrefix.get(AbstractBufferClusteringPrefix.java:55) ~[main/:na]
              at org.apache.cassandra.index.sasi.conf.ColumnIndex.getValueOf(ColumnIndex.java:235) ~[main/:na]
              at org.apache.cassandra.index.sasi.conf.ColumnIndex.index(ColumnIndex.java:104) ~[main/:na]
              at org.apache.cassandra.index.sasi.SASIIndex$1.insertRow(SASIIndex.java:254) ~[main/:na]
              at org.apache.cassandra.index.SecondaryIndexManager$WriteTimeTransaction.onInserted(SecondaryIndexManager.java:808) ~[main/:na]
              at org.apache.cassandra.db.partitions.AtomicBTreePartition$RowUpdater.apply(AtomicBTreePartition.java:335) ~[main/:na]
              at org.apache.cassandra.db.partitions.AtomicBTreePartition.addAllWithSizeDelta(AtomicBTreePartition.java:155) ~[main/:na]
              at org.apache.cassandra.db.Memtable.put(Memtable.java:251) ~[main/:na]
              at org.apache.cassandra.db.ColumnFamilyStore.apply(ColumnFamilyStore.java:1358) ~[main/:na]
              ... 12 common frames omitted
      

      I would say this issue is critical, as if it occurs, the node will crash on commitlog replay, too (if it was restarted for unrelated reason).

      However, the fix is relatively simple: check for static clustering in ColumnIndex.

      cc Pavel Yaskevich

        Attachments

          Activity

            People

            • Assignee:
              ifesdjeen Alex Petrov
              Reporter:
              ifesdjeen Alex Petrov
              Authors:
              Alex Petrov
              Reviewers:
              Pavel Yaskevich
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: