Hi,

As per document:
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useExpireExample.html


   -

   You can set a default TTL for an entire table by setting the table's
   default_time_to_live
   
<https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#tabProp__cqlTableDefaultTTL>
    property. If you try to set a TTL for a specific column that is longer
   than the time defined by the table TTL, Cassandra returns an error.


When I tried to test this statement, i found, we can insert data with TTL
greater than default_time_to_live. Is the document needs correction, or am
I mis-understanding it?

CREATE TABLE test (

    name text PRIMARY KEY,

    description text

) WITH bloom_filter_fp_chance = 0.01

    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}

    AND comment = ''

    AND compaction = {'class':
'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy',
'max_threshold': '32', 'min_threshold': '4'}

    AND compression = {'chunk_length_in_kb': '64', 'class':
'org.apache.cassandra.io.compress.LZ4Compressor'}

    AND crc_check_chance = 1.0

    AND dclocal_read_repair_chance = 0.1

    AND default_time_to_live = 240

    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_chance = 0.0

    AND speculative_retry = '99PERCENTILE';

insert into test (name, description) values ('name5', 'name description5')
using ttl 360;

select * from test ;


 name  | description

-------+-------------------

 name5 | name description5


SELECT TTL (description) from test;


 ttl(description)

------------------

             351

Can someone please clear this for me?

Reply via email to