Index state never change to ENABLED on Titan with Amazon DynamoDB backend

吃可爱长大的小学妹 提交于 2019-11-30 18:53:04

问题


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();
        }

A sample of the log is:

... ...

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


回答1:


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();


来源:https://stackoverflow.com/questions/35088574/index-state-never-change-to-enabled-on-titan-with-amazon-dynamodb-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!