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

java.lang.ArithmeticException: / by zero when index is created on table with clustering columns only

    XMLWordPrintableJSON

Details

    • Normal

    Description

      If we create an index over the clustering key of a table without regular columns:

      CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
      CREATE TABLE k.t (pk text, ck text, PRIMARY KEY (pk, ck));
      INSERT INTO k.t (pk, ck) VALUES ( 'pk','ck');
      CREATE INDEX idx ON k.t(ck);
      

      Then the following error index creation erros is logged:

      INFO  10:19:34 Submitting index build of idx for data in BigTableReader(path='/Users/adelapena/datastax/cassandra/data/data/k/t-ed3d6f90185611e7949f55d18a2e5858/mc-1-big-Data.db')
      ERROR 10:19:34 Exception in thread Thread[SecondaryIndexManagement:2,5,main]
      java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
      	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:402) ~[main/:na]
      	at org.apache.cassandra.index.internal.CassandraIndex.buildBlocking(CassandraIndex.java:723) ~[main/:na]
      	at org.apache.cassandra.index.internal.CassandraIndex.lambda$getBuildIndexTask$5(CassandraIndex.java:693) ~[main/:na]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_112]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_112]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]
      	at org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:79) [main/:na]
      	at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_112]
      Caused by: java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
      	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_112]
      	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_112]
      	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:398) ~[main/:na]
      	... 7 common frames omitted
      Caused by: java.lang.ArithmeticException: / by zero
      	at org.apache.cassandra.index.SecondaryIndexManager.calculateIndexingPageSize(SecondaryIndexManager.java:629) ~[main/:na]
      	at org.apache.cassandra.index.SecondaryIndexBuilder.build(SecondaryIndexBuilder.java:62) ~[main/:na]
      	at org.apache.cassandra.db.compaction.CompactionManager$11.run(CompactionManager.java:1347) ~[main/:na]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_112]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_112]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_112]
      	... 5 common frames omitted
      

      Any further queries using the index will fail:

      SELECT * FROM k.t where ck = 'ck';
      ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
      

      Attachments

        Issue Links

          Activity

            People

              adelapena Andres de la Peña
              adelapena Andres de la Peña
              Andres de la Peña
              Benjamin Lerer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: