本文介绍了带有Amazon DynamoDB后端的Titan上的索引状态永远不会更改为ENABLED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在DynamoDB上使用复合索引,并且索引从不从已安装切换到已注册状态。

I'm trying to use composite index on DynamoDB and the index never switches from from INSTALLED to REGISTERED state.

这是我用来创建它的代码

Here is the code I used to create it

        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 [main]信息
com.thinkaurelius .titan.graphdb.database.management.GraphIndexStatusWatcher
-索引myIndex上的某些键当前未注册:type = INSTALLED 613275 [main] INFO
com.thinkaurelius.titan.graphdb。 database.management.GraphIndexStatusWatcher
-索引typeIndex上的某些键当前未处于注册状态:type = INSTALLED 613275 [main] INFO
com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher
-等待索引typeIndex收敛于已注册状态时超时(PT1M)

612775 [main] INFO com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - Some key(s) on index myIndex do not currently have status REGISTERED: type=INSTALLED 613275 [main] INFO com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - Some key(s) on index typeIndex do not currently have status REGISTERED: type=INSTALLED 613275 [main] INFO com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - Timed out (PT1M) while waiting for index typeIndex to converge on status REGISTERED


推荐答案

等待更长的时间就可以了。示例:

Waiting for a longer time does the trick. Example:

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

这篇关于带有Amazon DynamoDB后端的Titan上的索引状态永远不会更改为ENABLED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 05:32