[ https://issues.apache.org/jira/browse/CASSANDRA-13400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15955067#comment-15955067 ]
Benjamin Lerer commented on CASSANDRA-13400: -------------------------------------------- +1 Thanks for the patch. > java.lang.ArithmeticException: / by zero when index is created on table with > clustering columns only > ---------------------------------------------------------------------------------------------------- > > Key: CASSANDRA-13400 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13400 > Project: Cassandra > Issue Type: Bug > Reporter: Andrés de la Peña > Assignee: Andrés de la Peña > Labels: 2i, secondary_index > Fix For: 3.0.x > > > If we create an index over the clustering key of a table without regular > columns: > {code} > 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); > {code} > Then the following error index creation erros is logged: > {code} > 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 > {code} > Any further queries using the index will fail: > {code} > 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'} > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)