无法通过 DynamoDB 删除 Titan 中的索引
Cannot remove index in Titan over DynamoDB
我使用 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
[警告]
代码在前提条件测试中失败。
我做错了什么?
原来我使用 position
定义了一个 属性 键,它是 DynamoDB 中的保留关键字。
唯一的方法是:
从Web控制台删除Titan的所有DynamoDB表,
将 'position' 更改为 'fieldPosition'、
并开始我的代码以从头开始创建表和索引。
我使用 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
[警告]
代码在前提条件测试中失败。
我做错了什么?
原来我使用 position
定义了一个 属性 键,它是 DynamoDB 中的保留关键字。
唯一的方法是:
从Web控制台删除Titan的所有DynamoDB表,
将 'position' 更改为 'fieldPosition'、
并开始我的代码以从头开始创建表和索引。