The only way to set a ttl on an entire existing CQL row is to Insert the row again with the same values. Is that correct? -> What do you mean by "entire existing CQL3 row" ? Do you mean setting TTL on every column of this row ? If so, the answer is yes, you need either to use INSERT or UPDATE by specifying all the columns in your statement.
"Wouldn't it be simpler if Cassandra just let us change the ttl on the row marker?" --> This is internal impl details, not supposed to be exposed as public API On Wed, Jun 11, 2014 at 2:33 PM, Or Sher <or.sh...@gmail.com> wrote: > Thanks DuyHai, > > Didn't had an idea it works like that is CQL. > So per my understanding, the only way to set a ttl on an entire existing > CQL row is to Insert the row again with the same values. Is that correct? > Wouldn't it be simpler if Cassandra just let us change the ttl on the row > marker? > > > On Wed, Jun 11, 2014 at 12:11 PM, DuyHai Doan <doanduy...@gmail.com> > wrote: > >> Yes, the TTL is also set on an internal row marker. More details on this >> here: https://issues.apache.org/jira/browse/CASSANDRA-6668 >> >> >> On Wed, Jun 11, 2014 at 10:38 AM, Or Sher <or.sh...@gmail.com> wrote: >> >>> Hi, >>> >>> Does that mean internally there is a TTL for an entire CQL row?? >>> I thought ttl are only attached to CQL row values (Columns which are not >>> in the PK). >>> I thought when all values of a row are deleted, it should mean that that >>> row does not exists. >>> >>> Please correct me where I'm wrong. >>> >>> >>> On Wed, Jun 11, 2014 at 11:18 AM, DuyHai Doan <doanduy...@gmail.com> >>> wrote: >>> >>>> Hello Or Sher, >>>> >>>> The behavior is quite normal: >>>> >>>> 1) insert into test_table (p1,p2,c1,d1,d2) values >>>> ('a','b','c','d','e'); --> Insert 5 columns without any TTL >>>> 2) update test_table using ttl 10 set d1='---', d2='---' where p1='a' >>>> and p2='b' and c1='c'; --> Re-insert columns d1 and d2 with new value and >>>> with TTL = 10 secs >>>> >>>> After a while, colums d1 and d2 expire but not columns p1,p2 and c1 >>>> >>>> 1) insert into test_table (p1,p2,c1,d1,d2) values >>>> ('a','b','c','---','---') using ttl 10; --> Insert 5 columns with TTL = 10 >>>> secs >>>> >>>> After a while, all 5 columns expire. Cassandra shows >>>> >>>> (0 rows) >>>> >>>> because semantically, the row no longer exist (the partition key >>>> expired) >>>> >>>> >>>> Regards >>>> >>>> Duy Hai DOAN >>>> >>>> >>>> On Wed, Jun 11, 2014 at 8:30 AM, Or Sher <or.sh...@gmail.com> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I encountered a strange phenomena (at least I believe it's strange) >>>>> when trying to set a ttl for a whole row. >>>>> When trying to set a ttl for a row using update statement and updating >>>>> all values I'm getting kind of a "phantom cql row". >>>>> When trying to do the same thing using an insert statement it behaves >>>>> as expected. >>>>> >>>>> Here is an example: >>>>> >>>>> cqlsh:testks> use testks; >>>>> cqlsh:testks> create table test_table( >>>>> ... p1 text, >>>>> ... p2 text, >>>>> ... c1 text, >>>>> ... d1 text, >>>>> ... d2 text, >>>>> ... primary key ((p1,p2),c1) >>>>> ... ); >>>>> cqlsh:testks> insert into test_table (p1,p2,c1,d1,d2) values >>>>> ('a','b','c','d','e'); >>>>> cqlsh:testks> update test_table using ttl 10 set d1='---', d2='---' >>>>> where p1='a' and p2='b' and c1='c'; >>>>> cqlsh:testks> select * from test_table; >>>>> >>>>> p1 | p2 | c1 | d1 | d2 >>>>> ----+----+----+-----+----- >>>>> a | b | c | --- | --- >>>>> >>>>> (1 rows) >>>>> >>>>> cqlsh:testks> select * from test_table; >>>>> >>>>> p1 | p2 | c1 | d1 | d2 >>>>> ----+----+----+------+------ >>>>> a | b | c | null | null >>>>> >>>>> (1 rows) >>>>> >>>>> cqlsh:testks> insert into test_table (p1,p2,c1,d1,d2) values >>>>> ('a','b','c','---','---') using ttl 10; >>>>> cqlsh:testks> select * from test_table; >>>>> >>>>> p1 | p2 | c1 | d1 | d2 >>>>> ----+----+----+-----+----- >>>>> a | b | c | --- | --- >>>>> >>>>> (1 rows) >>>>> >>>>> cqlsh:testks> select * from test_table; >>>>> >>>>> (0 rows) >>>>> >>>>> >>>>> >>>>> >>>>> Is this the expected behavior? >>>>> What's different in the delete and insert statement internally that >>>>> results in such a different behavior? >>>>> We're using C* 2.0.6 >>>>> >>>>> Thanks! >>>>> -- >>>>> Or Sher >>>>> >>>> >>>> >>> >>> >>> -- >>> Or Sher >>> >> >> > > > -- > Or Sher >