Understanding Token Function in Kassandra

Hello, I read the Cassandra documentation about the token function,

Documentation screenshot, https://docs.datastax.com/en/cql/3.1/cql/cql_using/paging_c.html

I am trying to achieve pagination of a Cassandra table, I cannot understand the highlighted rows. The document talks about the difference between k> 42 and TOKEN (k)> TOKEN (42), but I cannot understand the “token-based comparison”

We look forward to a detailed explanation of the validity of the token in the WHERE clause.

+3
source share
2 answers

, , C * PARTITION KEY . , node , ( , ). .

Murmur3Partitioner MurmurHash partion, ByteOrderedPartitioner : Murmur3Partitioner, , ByteOrderedPartitioner, .

, :

CREATE TABLE test (
    username text,
    ...
    PRIMARY KEY (username)
);

, , , abcd abce abcf. 0x61626364 0x61626365 0x61626366 . , MH3 (x86, 32- , ) ‭0x‭43ED676A‬‬ 0x‭‭E297E8AA‬‬ 0x‭‭87E62668‬‬ . , MH3 3 , BOP : 0x61626364, 0x61626365 0x61626366.

, , , . SELECT * FROM test; . ( ) , , , , , MH3, , ,

, TOKEN . :

TOKEN . TOKEN . , .

:

SELECT * FROM test WHERE TOKEN(username) <= TOKEN('abcf');

, ? abcd acbf !!! , ... , , C * (, Java).

, Murmur3Partitioner, . , - , , .

.

+9

Cassandra Token PartitionKey. Token . Token , - .

, .

+2

Source: https://habr.com/ru/post/1660343/


All Articles