Select distinct即使在主键Cassandra上执行,也会给出不正确的值



Im运行Cassandra版本2.1.2和cqlsh 5.0.1

这是weather.log表,weather是具有一致性级别一的keyspace。我配置了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]

我也尝试过将一致性级别设置为ALL的查询。它有力量工作。

为什么会发生这种情况?我需要拿到所有的钥匙。如何获取所有主键?

看起来您可能受到CASSANDRA-8940的影响。我建议更新到最新的2.1.x版本,并验证此问题是否已为您修复。

最新更新