我试图从Cassandra表读取数据时遇到了堰错误.我有一个单节点安装,默认设置.这是我正在进行的查询:
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';
Run Code Online (Sandbox Code Playgroud)
component_readings 是一个简单的表,没有聚类条件:
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)
);
Run Code Online (Sandbox Code Playgroud)
对于某些component_id值,它可以工作,而对于其他值,它会失败.这是我得到的错误:
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'}
Run Code Online (Sandbox Code Playgroud)
而cassandra的system.log显示了这个错误:
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
Run Code Online (Sandbox Code Playgroud)
奇怪的是,我只在从外部程序(通过python cassandra-connector)进行查询时才得到错误.如果我直接在cqlsh shell中创建它,它可以很好地工作.
我的安装是cassandra 2.2,但我升级到3.5,我得到了同样的错误.
Ral*_*alf 15
你超过了tombstone_failure_threshold.它默认为100'000.你也可以
要做后者,请更改表并将gc_grace_seconds设置为0:
ALTER TABLE component_readings WITH GC_GRACE_SECONDS = 0;
Run Code Online (Sandbox Code Playgroud)
然后通过nodetool触发压缩.这将清除所有墓碑.
在您的单节点群集的特定方案中,您可以将GC_GRACE_SECONDS保留为零.但是,如果您这样做,请记住,如果您想要使用多个节点,请撤消此操作!