Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading error in cassandra

Tags:

cassandra

I'm having a weir error trying to read data from a Cassandra table. I have a single-node installation, with the default setup. This is the query I'm making:

  SELECT component_id,
         reading_1,
         reading_2,
         reading_3,
         date
  FROM component_readings
  WHERE park_id=2
        AND component_id IN (479)
        AND date >= '2016-04-09+0000'
        AND date <= '2016-05-08+0000';

component_readings is a simple table, with no clustering conditions:

CREATE TABLE component_readings (
    park_id int,
    component_id int,
    date timestamp,
    reading_1 decimal,
    reading_2 decimal,
    ...
    PRIMARY KEY ((park_id), component_id, date)
);

With some component_id values, it works, and with another values, it fails. This is the error I'm getting:

cassandra.ReadFailure: code=1300 [Replica(s) failed to execute read] 
message="Operation failed - received 0 responses and 1 failures"
info={'required_responses': 1, 'received_responses': 0, 'failures': 1,
'consistency': 'LOCAL_ONE'}

And the cassandra's system.log shows this error:

ERROR [SharedPool-Worker-1] 2016-05-09 15:33:58,872 StorageProxy.java:1818 - 
Scanned over 100001 tombstones during query 'SELECT * FROM xrem.component_readings
WHERE park_id, component_id = 2, 479 AND date >= 2016-04-09 02:00+0200 AND date <=
2016-05-08 02:00+0200 LIMIT 5000' (last scanned row partion key was ((2, 479),
2016-05-04 17:30+0200)); query aborted

The weird thing is that I get the error only when making the query from an external program (via the python cassandra-connector). If I make it directly in the cqlsh shell, it works perfectly.

My installation was cassandra 2.2, but I've upgraded to 3.5, and I get the same error.

like image 630
César García Tapia Avatar asked May 09 '16 11:05

César García Tapia


1 Answers

You are exceeding the tombstone_failure_threshold. It defaults to 100'000. You can either

  • increase the value in the cassandra.yaml or
  • clean up your tombstones

To do the latter alter your table and set the gc_grace_seconds to 0:

ALTER TABLE component_readings WITH GC_GRACE_SECONDS = 0;

Then trigger a compaction via the nodetool. This will flush out all tombstones.

In your particular scenario of a one-node-cluster you could leave the GC_GRACE_SECONDS at zero. But if you do, keep in mind to undo this if you ever want to use more than one node!

like image 111
Ralf Avatar answered Nov 15 '22 13:11

Ralf