Check current TTL on collection columns in Cassandra

青春壹個敷衍的年華 提交于 2020-01-17 08:47:09

问题


Lets assume I have a Column Family with following schema:

CREATE TABLE users (
    user_id timeuuid,
    name varchar,
    last_name varchar,
    children list,
    phone_numbers map,
    PRIMARY KEY(user_id)
);

Then I insert a row into this CF with "USING TTL 60000". When I want to verify if any of these columns still has TTL set I get error: "Cannot use selection function ttl on collections".

My question is: how to get TTL on elements of a column that is defined as collection ?

Cheers!


回答1:


I reproduced your problem -- naturally getting the very same result. The problem is that either (1) in collections TTL's are element-wise (one TTL per entry in collection) and (2) I found no way of getting entries from Maps or Lists. Of course I can delete one element -- but selecting it or it's TTL was not possible. Even the Datastax' CQL driver v2 has not provided the metadata for that. So you may change your data structure for that. If this was 'just' for testing purposes you have to trust Cassandra doing this well enough.



来源:https://stackoverflow.com/questions/22201000/check-current-ttl-on-collection-columns-in-cassandra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!