Andrey:
cassandra every cell has a timestamp, select writetime (..) can see
the timestamp,
cassandra merge cells when compaction, when read, sort by timestamp.
for you example, if you left pad the writetime to column value (writetime +
cell value), then sort, shall return what you see now.
Regards,
Jim
On Tue, Aug 16, 2022 at 10:25 AM Andrey Zapariy <[email protected]>
wrote:
> Hello Cassandra users!
>
> I'm dealing with the unexpected behavior of the tie resolution for the
> same timestamp inserts. At least, unexpected for me.
> The following simple repro under Cassandra 3.11.4 illustrates the question:
>
> CREATE KEYSPACE the_test WITH replication = {'class': 'SimpleStrategy',
> 'replication_factor': '2'} AND durable_writes = true;
> CREATE TABLE the_test.case (id int, sort int, body text, size int, PRIMARY
> KEY (id, sort)) WITH CLUSTERING ORDER BY (sort ASC);
> INSERT INTO the_test.case (id, sort, body, size) VALUES (1, 2, 'foo foo',
> 7) USING TIMESTAMP 1660596312240;
> INSERT INTO the_test.case (id, sort, body, size) VALUES (1, 2, 'flap
> flap', 9) USING TIMESTAMP 1660596312240;
>
> After these two inserts I expect that either combination of <'foo foo',11>
> or combination of <'flap flap',9> would survive.
> But the select
> select id, sort, body, size from the_test.case where id=1 and sort=2;
> is giving rather uncomfortable result:
> id | sort | body | size
> ----+------+---------+------
> 1 | 2 | foo foo | 9
> Essentially, showing that timestamp tie resolution is performed on per
> cell basis, and not on row basis, as I was expecting.
>
> My questions are:
> Am I right about the way Cassandra does resolve timestamp ties?
> Or is there a way to configure Cassandra to perform per row resolution?
>
> Flushing data to sstables and dumping them, suggests that these inserts
> are stored as rows. And, naively thinking, I hope there is a way to make
> the whole row insert to survive.
>
>
>