2

I have been trying to run a query like this:

SELECT COUNT(*) FROM sensors WHERE sensor_id = 1 and date = '2014-11';

on a column family. The WHERE clause filters down to a partition key with around 2 million columns. I expect to get a count result of approx. 2 million, but instead I get this error:

errors={}, last_host=[THE_IP_OF_MY_SERVER]

if I run the query to get the columns it returns the data just fine, but it cannot return the count. I understand the performance issues such count query might have (for example the ones discussed here) but I still would like to get some result for this query for my tests.

So my question is:

  1. Is this a timeout error? if yes how I can increase the timeout period?
  2. If not, why I get this error? is there a way to get more details on this? I checked the system.log on each node in my cluster and none had anything printed during the query.

I am using Cassandra 2.1 with cqlsh 5.0.1 and spec 3.2 on a cluster of two nodes both running Ubuntu 14.04.

Thanks

m.hashemian
  • 1,786
  • 2
  • 15
  • 31
  • 2
    To help troubleshoot, you could try the [TRACING command](http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/tracing_r.html) command in `cqlsh`. You could try for both `select * ...` and `select count(*) ...` queries to see the behavior in both cases. – BrianC Jan 04 '15 at 20:41

2 Answers2

3

Edit ~/.cqlshrc or ~/.cassandra/cqlshrc with:

[connection]
client_timeout = 20

tweak the timeout number (in second) as you want.

C.B.
  • 766
  • 1
  • 6
  • 7
2

It should be a timeout. You can increase the maximum time needed for the request by changing the value of "read_request_timeout_in_ms" or even "range_request_timeout_in_ms" (in cassandra.yaml) if you plan to use range queries. Restart the cluster after changing the values (they default to 10 seconds).

Note that if you run exact queries on partition keys you will get 0 or 1 as count. So your query is on clustering columns (the ones after the first column of primary key) if it returns more than 1 row.

Nicola Ferraro
  • 4,051
  • 5
  • 28
  • 60
  • I increased the timeout (x10) but still get the same error. Before modifying the timeout, I used cqlsh client on my laptop (older version, cqlsh 4.1.0, CQL spec 3.1.1) to run the same query. This time I got the response after 30s (though the timeout for read was 5s and for range was 10s)! I agree with you that most probably the problem is with the timeout, but not sure why on cql4.1 I did not get timeout regardless, and on 5.0.1 I got timeout even after changing the settings and rebooting the server? – m.hashemian Jan 04 '15 at 20:07