apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.65k stars 518 forks source link

构建图谱后,运行几天后 hugeserver 后台 vertex 类型反序列化转换报错 #1368

Closed JackyYangPassion closed 3 years ago

JackyYangPassion commented 3 years ago

错误堆栈 [grizzly-http-server-1] [ERROR] com.baidu.hugegraph.backend.Transaction [] - Failed to parse entry: java.lang.IllegalArgumentException: Vertex label can't be changed from 'A(id=5)' to 'B(id=7)' at com.google.common.base.Preconditions.checkArgument(Preconditions.java:163) ~[guava-25.1-jre.jar:?] at com.baidu.hugegraph.util.E.checkArgument(E.java:56) ~[hugegraph-common-1.8.1.jar:1.8.1.0] at com.baidu.hugegraph.structure.HugeVertex.correctVertexLabel(HugeVertex.java:185) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.structure.HugeEdge.constructEdge(HugeEdge.java:502) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.serializer.BinarySerializer.parseEdge(BinarySerializer.java:268) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.serializer.BinarySerializer.parseColumn(BinarySerializer.java:315) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.serializer.BinarySerializer.readVertex(BinarySerializer.java:425) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.parseEntry(GraphTransaction.java:1814) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.lambda$queryEdgesFromBackend$7(GraphTransaction.java:944) ~[hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.iterator.FlatMapperIterator.fetch(FlatMapperIterator.java:62) [hugegraph-common-1.8.1.jar:1.8.1.0] at com.baidu.hugegraph.iterator.WrappedIterator.hasNext(WrappedIterator.java:40) [hugegraph-common-1.8.1.jar:1.8.1.0] at com.baidu.hugegraph.backend.cache.CachedGraphTransaction.queryEdgesFromBackend(CachedGraphTransaction.java:271) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.queryEdges(GraphTransaction.java:902) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.StandardHugeGraph.edges(StandardHugeGraph.java:585) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.HugeTraverser.edgesOfVertex(HugeTraverser.java:178) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.HugeTraverser.edgesOfVertex(HugeTraverser.java:184) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.HugeTraverser.edgesOfVertex(HugeTraverser.java:197) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.HugeTraverser.adjacentVertices(HugeTraverser.java:151) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.OltpTraverser.adjacentVertices(OltpTraverser.java:86) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.KneighborTraverser.customizedKneighbor(KneighborTraverser.java:92) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.traversal.algorithm.KneighborTraverser.customizedKneighbor(KneighborTraverser.java:76) [hugegraph-core-0.11.2.jar:0.11.2.0] at com.baidu.hugegraph.api.traversers.KneighborAPI.post(KneighborAPI.java:131) [hugegraph-api-0.11.2.jar:0.58.0.0] at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_172] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_172] at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [jersey-common-2.25.1.jar:?] at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [jersey-server-2.25.1.jar:?] at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [jersey-container-grizzly2-http-2.25.1.jar:?] at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200) [grizzly-http-server-2.4.4.jar:2.4.4] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) [grizzly-framework-2.4.4.jar:2.4.4] at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) [grizzly-framework-2.4.4.jar:2.4.4] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172] 对应代码 private HugeVertex parseEntry(BackendEntry entry) { try { HugeVertex vertex = this.serializer.readVertex(graph(), entry);//此处抛出异常 assert vertex != null; return vertex; } catch (Throwable e) { LOG.error("Failed to parse entry: {}", entry, e); if (this.ignoreInvalidEntry) { return null; } throw e; } }

Steps to reproduce the problem 复现步骤

客户端调用接口: http://localhost:8080/graphs/hugegraph/traversers/kneighbor

Specifications of environment 环境信息

javeme commented 3 years ago

@JackyYangPassion 因为存在错误的边,连接了非法类型的顶点。比如定义变类型friend是person-person的,但是存在一条friend边连接的是person-book。可能是一个类型的顶点覆盖了不同类型的顶点导致,可以在写入数据时打开检查,或者在关闭检查时自行保证数据是合法的。

JackyYangPassion commented 3 years ago

@JackyYangPassion 因为存在错误的边,连接了非法类型的顶点。比如定义变类型friend是person-person的,但是存在一条friend边连接的是person-book。可能是一个类型的顶点覆盖了不同类型的顶点导致,可以在写入数据时打开检查,或者在关闭检查时自行保证数据是合法的。

  1. 这里是指 A类型的点和B类型的点 有数值冲突,就是 点类型A,B 均有 value = XXX的吗?
Linary commented 3 years ago

@JackyYangPassion 是的,是这个意思。有两种方式避免此问题

  1. 使用primarykey的Id策略,这样id里面会带上label的信息;
  2. 将检查id是否存在的开关打开,vertex.check_customized_id_exist=true
JackyYangPassion commented 3 years ago

@JackyYangPassion 是的,是这个意思。有两种方式避免此问题

  1. 使用primarykey的Id策略,这样id里面会带上label的信息;
  2. 将检查id是否存在的开关打开,vertex.check_customized_id_exist=true

感谢,昨天从数据侧确认这是这个问题,使用primarykey的Id策略 再试下