我使用AWSKeyspace (cassandra)和elasticsearch作为存储后端和索引后端。我有一个要求删除所有的边缘超过30天。在edge属性上设置TTL不像预期的那样工作(下面是错误)。
ERROR org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager - Could not create GremlinScriptEngine for gremlin-groovy
java.lang.IllegalStateException: javax.script.ScriptException: javax.script.ScriptException:
java.lang.UnsupportedOperationException: The storage engine does not support TTL我的剧本如下:
edgeId = mgmt.getPropertyKey("edge_id")
sourceId = mgmt.getPropertyKey("source_id")
severity = mgmt.getPropertyKey("severity")
source = mgmt.getPropertyKey("source")
createdAt = mgmt.getPropertyKey("created_at")
alertStatus = mgmt.getPropertyKey("alert_status")
investigationStatus = mgmt.getPropertyKey("investigation_status")
investigationPriority = mgmt.getPropertyKey("investigation_priority")
attributes = mgmt.getPropertyKey("attributes")
edgeType = mgmt.getPropertyKey("edge_type")
if (!mgmt.containsGraphIndex(edgeIndexName)) {
mgmt.buildIndex(edgeIndexName, Edge.class).
addKey(edgeType, Mapping.TEXT.asParameter()).
addKey(tenant, Mapping.TEXT.asParameter()).
addKey(severity, Mapping.DEFAULT.asParameter()).
addKey(source, Mapping.TEXT.asParameter()).
addKey(createdAt, Mapping.DEFAULT.asParameter()).
addKey(investigationPriority, Mapping.DEFAULT.asParameter()).
addKey(attributes, Mapping.TEXT.asParameter()).
buildMixedIndex(indexBackendName)
}
makeEdgeCompositeIndex(mgmt, edgeCompositeIndexName, edgeId)
makeEdgeCompositeIndex(mgmt, edgeCompositeIndexName, sourceId)
// ###########
// Add TTL
// ###########
mgmt.setTTL(sourceId, Duration.ofDays(30))我确实尝试过用cassandra替换AWSKeyspace,并在docker文件中运行相同的脚本,并且运行良好(TTL设置)。就像cassandra AWSKeyspace支持添加TTL一样。
发布于 2022-11-14 16:51:25
当使用Amazon时,需要使用如下语句启用TTL
ALTER TABLE my_table WITH CUSTOM_PROPERTIES={'ttl':{'status': 'enabled'}};发布于 2022-11-15 19:26:07
这被设置为false可能是因为键空间TTL支持在完成对keyspace支持的PR之后进行了GA:
公关:2021年6月https://github.com/JanusGraph/janusgraph/pull/2644
TTL GA: 10t 2021 https://aws.amazon.com/blogs/database/announcing-amazon-keyspaces-time-to-live-ttl-general-availability/
如果测试成功,现在可以将其设置为真。
https://stackoverflow.com/questions/74432527
复制相似问题