2016-04-11 18 views
1

林進行運行卡桑德拉版2.1.2和5.0.1 cqlshSELECT DISTINCT即使在主鍵卡桑德拉

下面是表weather.log給出不正確的值,耐候性具有一致性水平的一種密鑰空間。 我有2個節點配置。

CREATE KEYSPACE weather WITH replication = {'class': 'NetworkTopologyStrategy', 'us-east': '1'} AND durable_writes = true;

CREATE TABLE weather.log ( ip inet, ts timestamp, city text, country text, PRIMARY KEY (ip, ts) ) WITH CLUSTERING ORDER BY (ts DESC) AND bloom_filter_fp_chance = 0.01 AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}' AND comment = '' AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'} AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair_chance = 0.0 AND speculative_retry = '99.0PERCENTILE';

當我們運行查詢。

select distinct ip from weather.log

我們得到不一致的,錯誤的反應。一旦我們得到99下一次我們得到1600等[其中實際數量應該> 2000]

我已經試過這個查詢與一致性級別設置爲所有也。它力求工作。

這是怎麼發生的?我需要得到所有的鑰匙。如何獲得所有主鍵?

+0

你嘗試添加ALLOW FILTERING子句嗎? – Whitefret

+0

SELECT DISTINCT只能用於主鍵。 – Raedwald

+0

@Raedwald ip是主鍵嗎? – mehnaazm

回答

2

看起來你可能會受到CASSANDRA-8940的影響。我建議更新到最新的2.1.x版本,並驗證這個問題是否爲您解決。