在使用亚马逊DynamoDB后端的Titan时,索引状态从未更改为启用。

3

我正在尝试在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 [main] 信息 com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - 索引 myIndex 上的某些键当前没有状态 REGISTERED:type=INSTALLED 613275 [main] 信息 com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - 索引 typeIndex 上的某些键当前没有状态 REGISTERED:type=INSTALLED 613275 [main] 信息 com.thinkaurelius.titan.graphdb.database.management.GraphIndexStatusWatcher - 在等待索引 typeIndex 收敛到状态 REGISTERED 时超时 (PT1M)


注意:本文只是翻译,不提供解释。保留了HTML标签,请勿删除。

1
嘿 M-T-A,你能让这个工作起来了吗?我在使用 Titan + Cassandra 时遇到了类似的问题。 - balaji
不,希望Titan的人能对此做出回应。 - Mohamed Taher Alrefaie
我所观察到的是,如果给定标签没有数据,则索引会转移到启用状态,但如果已经存在一些数据,则它会停留在已安装状态。 - balaji
此外,即使没有其他处于停滞/不活动状态的实例打开,这种行为也是相同的。 - balaji
1个回答

3

多等一会就能解决问题。例如:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接