I have a situation where i need run some query on a database based on hour(partition key).
Earlier the solution was based on in query where query consists of may be thousands of hours in the in section.
SELECT field1,field2,hour FROM tablex WHERE hour IN (hour1, hour2, hour3, ..., hour2000);
The query was timing out at times ..i went online and got a suggestion to leverage on cassandra capability to identify node based on partiotion keys hash and split all in queries into individual equal= hour query. So now i have some 2000 async queries something like:
SELECT field1,field2,hour from tablex where hour = hour1; SELECT field1,field2,hour from tablex where hour =hour2; SELECT field1,field2,hour from tablex where hour =hour3; ...
I did that with async session api..I am still getting error which is :
Cassandra timeout during read query at consistency LOCAL_QUORUM (2 responses were required but only 1 replica responded)","stacktrace":"com.datastax.oss.driver.api.core.servererrors.ReadTimeoutException: Cassandra timeout during read query at consistency LOCAL_QUORUM (2 responses were required but only 1 replica responded) at com.datastax.oss.driver.api.core.servererrors.ReadTimeoutException.copy(ReadTimeoutException.java:111) at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:149) at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:53) at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:30) at com.datastax.oss.driver.internal.core.session.DefaultSession.execute(DefaultSession.java:230)
I am still not very convinced with this new approach as i have lots of query to execute but probably it will distribute the query to multiple nodes .
- how to get rid of this read timeout exception: It seems there is some read timeout within cluster level which may be causing it.on driver level my timeout is 12s(DSE driver version 4.9).with below statements :.withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds(12))
- Any better way to do this.