索引状态永远不会改变为使用Amazon DynamoDB后端的Titan上的ENABLED

时间:2016-01-29 15:51:42

标签: amazon-dynamodb titan

我尝试在DynamoDB上使用复合索引,索引永远不会从INSTALLED切换到REGISTERED状态。

以下是我用来创建它的代码

        graph.tx().rollback(); //Never create new indexes while a transaction is active
        TitanManagement mgmt=graph.openManagement();
        PropertyKey propertyKey=getOrCreateIfNotExist(mgmt, "propertyKeyName");
        String indexName = makePropertyKeyIndexName(propertyKey);

        if (mgmt.getGraphIndex(indexName)==null) {
            mgmt.buildIndex(indexName, Vertex.class).addKey(propertyKey).buildCompositeIndex();
            mgmt.commit();
            graph.tx().commit();
            ManagementSystem.awaitGraphIndexStatus(graph, indexName).status(SchemaStatus.REGISTERED).call(); 
        }else {
            mgmt.rollback();
        }

日志样本是:

  

...   ...

     

612775 [主要]信息   com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher    - 索引myIndex上的某些键当前没有状态REGISTERED:type = INSTALLED 613275 [main] INFO   com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher    - 索引typeIndex上的某些键当前的状态为REGISTERED:type = INSTALLED 613275 [main] INFO   com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher    - 等待索引typeIndex收敛状态REGISTERED

时超时(PT1M)

1 个答案:

答案 0 :(得分:2)

等待更长时间才能解决问题。例如:

ManagementSystem.awaitGraphIndexStatus(graph, propertyKeyIndexName)
                    .status(SchemaStatus.ENABLED)
                    .timeout(10, ChronoUnit.MINUTES) // set timeout to 10 min
                    .call();