检查Cassandra中收集列上的当前TTL [英] Check current TTL on collection columns in Cassandra

查看:513
本文介绍了检查Cassandra中收集列上的当前TTL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个具有以下架构的列族:

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)
);

然后,我在该CF中插入一行使用TTL 60000。当我想验证这些列中是否还有TTL设置时,出现错误:无法在集合上使用选择函数ttl。

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".

我的问题是:如何获取定义为集合的列元素上的TTL?

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

干杯!

推荐答案

我转载了您的问题-自然得到了相同的结果。问题在于(1)集合TTL中的元素是按元素分配的(集合中每个条目一个TTL),以及(2)我找不到从地图或列表中获取条目的方法。
当然我可以删除一个元素-但无法选择它或TTL。甚至Datastax的CQL驱动程序v2都没有为此提供元数据。
因此,您可以为此更改数据结构。如果这只是出于测试目的,那么您就必须相信Cassandra做得足够好。

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.

这篇关于检查Cassandra中收集列上的当前TTL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆