问题
I've created a table like:
CREATE TABLE IF NOT EXISTS metrics_second(
timestamp timestamp,
value counter,
PRIMARY KEY ((timestamp))
) WITH default_time_to_live=1;
And inserted some data like:
UPDATE metrics_second SET value = value + 1 WHERE timestamp = '2015-01-22 17:43:55-0800';
When executing SELECT * FROM metrics_second
I always see the data, even after a minute or so, although the default_time_to_live
property of the table is set to one second. Why is that?
回答1:
As @RussS confirmed, unfortunately Cassandra doesn't support TTL on tables or rows when there are counters.
Even if default_time_to_live
is being set when creating the table and no error is being returned, Cassandra won't enforce the TTL.
来源:https://stackoverflow.com/questions/28120834/cassandra-default-time-to-live-property-is-not-deleting-data