deenbandhu
deenbandhu

Reputation: 599

Cassandra TTL changed Automatically

I am having a column family in cassandra with default ttl as 3024000(35 days),compaction strategy is LCS and table structure is something like this

CREATE TABLE xyz (
logdate text,
cookieid text,
count1 int,
count2 int,
count3 int,
PRIMARY KEY (logdate, cookieid)
) WITH CLUSTERING ORDER BY (cookieid ASC)

but when i am checking the ttl of 35 old days data it is still showing 20 days i am not getting why this is happening. Do anybody have idea about this? Is this because of compaction ?

Upvotes: 1

Views: 87

Answers (1)

Gunwant
Gunwant

Reputation: 979

This could happen if you have reinserted the same row.

For example

INSERT INTO XYZ VALUES(100,..........some value) -- lets say inserted 10 days back.

If the row is not inserted again the TTl could have shown 25 days, but what might had happend is the row gets inserted again.

INSERT INTO XYZ VALUES(100,..........some other value ) -- lets say inserted 5 days back.

The TTL will be 30 days.

TTL value gets reset at every insert of the row (same row key).

Upvotes: 2

Related Questions