我使用Dynamo DB后端和Elasticsearch在Titan 1.0上创建了一个混合索引,我试图使用以下代码将其删除
public static void removeIndex(TitanGraph graph, String indexStr) throws ExecutionException, InterruptedException {
TitanManagement m = graph.openManagement();
TitanGraphIndex nameIndex = m.getGraphIndex(indexStr);
Preconditions.checkState(nameIndex!=null, "index "+ indexStr +" doesn't exist");
TitanManagement.IndexJobFuture futureDisable = m.updateIndex(nameIndex, SchemaAction.DISABLE_INDEX);
m.commit();
graph.tx().commit();
futureDisable.get();
// Block until the SchemaStatus transitions from to DISABLED
ManagementSystem.awaitGraphIndexStatus(graph, indexStr)
.status(SchemaStatus.DISABLED).call();
// Delete the index using TitanManagement
m = graph.openManagement();
nameIndex = m.getGraphIndex(indexStr);
TitanManagement.IndexJobFuture futureRemove =
m.updateIndex(nameIndex, SchemaAction.REMOVE_INDEX);
m.commit();
graph.tx().commit();
Preconditions.checkState(futureRemove!=null,
"Couldn't remove index/es because seems like indexes were not disabled."); // fails here.
futureRemove.get();
m = graph.openManagement();
nameIndex = m.getGraphIndex(indexStr);
Preconditions.checkArgument(nameIndex==null);
}
密钥不会被删除。我收到此警告,表明索引永远不会被禁用。
---
INFO com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - Some key(s) on index verticesIndex do not currently have status DISABLED: position=INSTALLED
INFO com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - Timed out (PT1M) while waiting for index verticesIndex to converge on status DISABLED
[警告]
代码在前置条件测试中失败。
我做错了什么?
答案 0 :(得分:1)
事实证明我使用position
来定义属性键,它是DynamoDB中的保留关键字。
唯一的方法是:
从Web控制台删除Titan的所有DynamoDB表,
将'position'更改为'fieldPosition',
并启动我的代码以从头开始创建表和索引。