Cassandra 应该尊重 timeuuid 集群键的顺序吗?

问题描述 投票:0回答:1

cassandra:4.1.3 Docker 容器的以下行为是否符合预期(其中第二个列出的 c_key 小于第一个)?

cassandra@cqlsh> describe table foobars.foobars;

CREATE TABLE foobars.foobars (
    pkey timeuuid,
    w_ckey text,
    c_ckey timeuuid,
    bar text,
    foo uuid,
    PRIMARY KEY (pkey, w_ckey, c_ckey)
) WITH CLUSTERING ORDER BY (w_ckey ASC, c_ckey ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND default_time_to_live = 0
    AND extensions = {}
    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 = 'BLOCKING'
    AND speculative_retry = '99p';
cassandra@cqlsh> select * from foobars.foobars where pkey = b98fea01-9b8b-11ee-9e71-937c45431a90 and w_ckey = 'foobar 2';

 pkey                                 | w_ckey   | c_ckey                               | bar | foo
--------------------------------------+----------+--------------------------------------+-----+--------------------------------------
 b98fea01-9b8b-11ee-9e71-937c45431a90 | foobar 2 | b98fea00-9b8b-11ee-9e71-937c4543ffff | bar | b9a21270-9b8b-11ee-9e71-937c45431a90
 b98fea01-9b8b-11ee-9e71-937c45431a90 | foobar 2 | b98fea00-9b8b-11ee-9e71-937c45431fff | bar | b99c6d20-9b8b-11ee-9e71-937c45431a90

(2 rows)

我创建了两行(通过映射器)。我预计具有较低值 timeuuid 最终聚类键的行会在较高值之前列出。 (所表示的位要么相同,要么明显更大,其中一个有 F,而另一个没有。)Mapper 和 cqlsh 都以似乎随机的方式报告行;有时顺序符合预期,有时则不然。

cqlsh cassandra-4.0
1个回答
0
投票

没关系;对于聚类列排序,忽略 timeuuid 的非时间部分是有意义的。

© www.soinside.com 2019 - 2024. All rights reserved.