m.hashemian
m.hashemian

Reputation: 1826

Cassandra cqlsh query fails with no error

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

Upvotes: 2

Views: 1681

Answers (2)

C.B.
C.B.

Reputation: 786

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

[connection]
client_timeout = 20

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

Upvotes: 3

Nicola Ferraro
Nicola Ferraro

Reputation: 4179

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.

Upvotes: 2

Related Questions