[ https://issues.apache.org/jira/browse/CASSANDRA-4938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251422#comment-17251422 ]
Kirk True commented on CASSANDRA-4938: -------------------------------------- When trying to query against the table using the index before it's fully created, I see this error on the server: {noformat} java.lang.RuntimeException: org.apache.cassandra.index.IndexNotAvailableException: The secondary index 'test_table_user_name_idx' is not yet available at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2729) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:134) at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:119) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.apache.cassandra.index.IndexNotAvailableException: The secondary index 'test_table_user_name_idx' is not yet available at org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:445) at org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2011) at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2725) ... 6 common frames omitted {noformat} and this in `cqlsh`: {noformat} ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures: UNKNOWN from localhost/127.0.0.1:7000" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'} {noformat} It looks like the schema update event is fired on the _start_ of the index creation, not on its _completion_. > CREATE INDEX can block for creation now that schema changes may be concurrent > ----------------------------------------------------------------------------- > > Key: CASSANDRA-4938 > URL: https://issues.apache.org/jira/browse/CASSANDRA-4938 > Project: Cassandra > Issue Type: Improvement > Components: Feature/2i Index > Reporter: Krzysztof Cieslinski Cognitum > Assignee: Kirk True > Priority: Low > Labels: lhf > Fix For: 4.x > > > Response from CREATE INDEX command comes faster than the creation of > secondary index. So below code: > {code:xml} > CREATE INDEX ON tab(name); > SELECT * FROM tab WHERE name = 'Chris'; > {code} > doesn't return any rows(of course, in column family "tab", there are some > records with "name" value = 'Chris'..) and any errors ( i would expect > something like ??"Bad Request: No indexed columns present in by-columns > clause with Equal operator"??) > Inputing some timeout between those two commands resolves the problem, so: > {code:xml} > CREATE INDEX ON tab(name); > Sleep(timeout); // for column family with 2000 rows the timeout had to be set > for ~1 second > SELECT * FROM tab WHERE name = 'Chris'; > {code} > will return all rows with values as specified. > I'm using single node cluster. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org