incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

getVertex报错

Open broken-blade opened this issue 6 years ago • 4 comments

Expected behavior 期望表现

通过getVertex(vertexID)能正常获取顶点

Actual behavior 实际表现

报错,javax.ws.rs.NotFoundException: VERTEX with id '"1:642637192506268962"' does not exist; 使用该id从 hugegraph-studio上查询,可以查到这个顶点

Steps to reproduce the problem 复现步骤

我在向hugegraph模拟图数据,大致流程为: 1.通过getOrCreate方法创建顶点,并使用Map<cardID, vertexID>,映射顶点ID,如果顶点不存在则创建,存在则通过vertexID获取 2.程序执行一会就会报错,多次执行都不成功 3.使用rocksdb作为存储后端可以正常执行,使用Cassandra就会报错

getOrCreate方法大致实现: Map<String, Object> cache = new HashMap<String, Object>(); GraphManager graph = hugeClient.graph();

protected Vertex getOrCreate(List value, String label) { Vertex vertex; String cardID = (String) value.get(2); if (cache.containsKey(cardID)) { Object vertexID = cache.get(cardID); vertex = graph.getVertex(vertexID); } else { vertex = graph.addVertex(T.label, label, "name", value.get(0), "gender", value.get(1), "cardID", cardID, "phoneNO", value.get(3)); cache.put(cardID, vertex.id()); } }

Status of loaded data 数据状态

Vertex/Edge summary 数据量

  • loaded vertices amount: {like 10 million}
  • loaded edges amount: {like 20 million}
  • loaded time: {like 200s}

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

  • hugegraph version: 0.9.2
  • operating system: centos 7.5
  • hugegraph backend: apache-cassandra-3.11.4, cluster with 3 nodes

broken-blade avatar Feb 26 '20 02:02 broken-blade

@userhtm 跑多少条数据之后会报错?另外能否提供一下数据样例以方便复现分析

javeme avatar Feb 26 '20 12:02 javeme

@userhtm 你好,能给出一段复现此问题的最小版本的代码吗?除了getOrCreate方法,构造的模拟数据,怎么调getOrCreate方法的也贴一下,不方便的地方用伪代码或文字代替也可以

Linary avatar Feb 27 '20 07:02 Linary

@Linary 你好 1.我是先取一条完整的数据进行插入的,包括源顶点、目标定点、连接两个顶点的边;然后调用GetOrCreate()方法,获取或创建两个顶点,再调用relateNodes()创建边 2.调用方式大致如下: `

//遍历数据集
for (...){
    //获取源顶点和目标定点
    Vertex sourceNode = getOrCreate(scrVertexListData, srcVertexLabel);
    Vertex destNode = getOrCreate(destVertexListData, destVertexLabel);
    //创建连接两个顶点的边
    relateNodes(sourceNode, destNode, edgeLabel, edgeProperties);
}

`

3.relateNodes方法 `

List<Edge> edges = new LinkedList<>();
@Override
protected void relateNodes(Vertex src, Vertex dest, String edgeLabel, List<Object> properties) {
    Edge edge = new Edge(edgeLabel).source(src).target(dest).
            property("callTime", properties.get(0)).property("duration", properties.get(1));
    edges.add(edge);
     //每500条数据执行一次插入
    if (edges.size() % batchSize == 0) {
        //插入边
        graph.addEdges(edges);
        edges = new LinkedList<>();
    }
}`

broken-blade avatar Feb 27 '20 08:02 broken-blade

Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label

github-actions[bot] avatar Sep 04 '21 21:09 github-actions[bot]