janusGraph中的REINDEX状态未更改为“ registered / ENABLED”

时间:2018-07-12 07:50:57

标签: indexing janusgraph

在创建索引时,在后端和空数据库上使用Cassandra集群,索引状态变为 ENABLED ,并且可以正常工作。

当我对现有数据的属性(即200个节点,200个链接)进行重新索引时,INDEX状态仍然保持为已安装

    mgmt = graph.openManagement();     
    JanusGraphIndex clientIdIpAddressIndex = mgmt.getGraphIndex("clientIdIpAddressIndex");
     if(clientIdIpAddressIndex == null) {
        IndexBuilder builder = mgmt.buildIndex("clientIdIpAddressIndex", Vertex.class).addKey(tenantId).addKey(ipAddressKey);
        builder.buildCompositeIndex();
     }

    mgmt.commit();
    if (reIndexData) {   
      for(JanusGraphTransaction jgtx : graph.getOpenTransactions()) {
         jgtx.rollback();
      }                 
      mgmt = graph.openManagement();
      for(String instance : mgmt.getOpenInstances()) {
        try {
            mgmt.forceCloseInstance(instance);
        }
        catch(IllegalArgumentException e) {
            log.error("Caught Illegal argument Exception");
        }
      }
      mgmt = graph.openManagement();
      ManagementSystem.awaitGraphIndexStatus(graph, "clientIdIpAddressIndex").status(SchemaStatus.REGISTERED).call(); 
      mgmt.updateIndex(mgmt.getGraphIndex("clientIdIpAddressIndex"), SchemaAction.REINDEX).get(); 
      JanusGraphIndex i2 = mgmt.getGraphIndex("clientIdIpAddressIndex");
      SchemaStatus UpdatedIpAddStatus = i2.getIndexStatus(mgmt.getPropertyKey(NetworkTopologyConstants.IPADDRESS.getName()));
      log.error("After awaiting index IpAdd status: {}",UpdatedIpAddStatus);                
      mgmt.commit();
  }

输出:

ERROR Thread-32 org.janusgraph.graphdb.database.management.ManagementLogger - Evicted [1@c0a8387a28931-itomlab1] from cache but waiting too long for transactions to close. Stale transaction alert on: [standardjanusgraphtx[0x4444124a]]
ERROR https-jsse-nio-192.168.56.121-443-exec-11 com.vistara.graphdb.service.impl.GraphDBManagementServiceImpl - After awaiting index IpAdd status: INSTALLED

如何对现有数据进行 REINDEXING 的同时将INDEX状态更改为 ENABLED 状态? 帮助我们实现REINDEX。

0 个答案:

没有答案