JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.19k stars 1.16k forks source link

Gryo reader / writer is broken in JanusGraph 1.0.0 #4087

Open porunov opened 8 months ago

porunov commented 8 months ago

As noted in the changelog: https://docs.janusgraph.org/changelog/#drop-support-for-gryo-messageserializer Gryo MessageSerializer has been dropped in TinkerPop 3.6.0. However, TinkerPop documentation says that Gryo may still be used for file based applications.

For confirmed bugs, please report:

Unable to create serializer "org.apache.tinkerpop.shaded.kryo.serializers.FieldSerializer" for class: java.util.concurrent.atomic.AtomicLong
angu2015 commented 3 days ago

I am facing below issue while importing the graph snapshot which is taken using the gryo in janusgraph 1.0.0. whereas the same code is working fine in janus 0.6.2

11:20:53 ERROR org.apache.tinkerpop.gremlin.server.GremlinServer.start - Gremlin Server Error java.lang.RuntimeException: java.lang.IllegalArgumentException: Must provide vertex id at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader$VertexInputIterator.next(GryoReader.java:333) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader$VertexInputIterator.next(GryoReader.java:307) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.iterate(IteratorUtils.java:73) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.readGraph(GryoReader.java:94) ~[gremlin-core-3.7.0.jar:3.7.0] at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) ~[groovy-4.0.9.jar:4.0.9] at Script1$_run_closure1.doCall(Script1.groovy:349) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343) ~[groovy-4.0.9.jar:4.0.9] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328) ~[groovy-4.0.9.jar:4.0.9] at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279) ~[groovy-4.0.9.jar:4.0.9] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009) ~[groovy-4.0.9.jar:4.0.9] at groovy.lang.Closure.call(Closure.java:418) ~[groovy-4.0.9.jar:4.0.9] at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:54) ~[groovy-4.0.9.jar:4.0.9] at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113) ~[groovy-4.0.9.jar:4.0.9] at com.sun.proxy.$Proxy28.onStartUp(Unknown Source) ~[?:?] at org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$start$1(GremlinServer.java:159) ~[gremlin-server-3.7.0.jar:3.7.0] at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?] at org.apache.tinkerpop.gremlin.server.GremlinServer.start(GremlinServer.java:156) [gremlin-server-3.7.0.jar:3.7.0] at org.janusgraph.graphdb.server.JanusGraphServer.start(JanusGraphServer.java:98) [janusgraph-server-1.0.0.jar:?] at org.janusgraph.graphdb.server.JanusGraphServer.main(JanusGraphServer.java:53) [janusgraph-server-1.0.0.jar:?] Caused by: java.lang.IllegalArgumentException: Must provide vertex id at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-32.1.3-jre.jar:?] at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addVertex(StandardJanusGraphTx.java:609) ~[janusgraph-core-1.0.0.jar:?] at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsTransaction.addVertex(JanusGraphBlueprintsTransaction.java:138) ~[janusgraph-core-1.0.0.jar:?] at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:143) ~[janusgraph-core-1.0.0.jar:?] at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:59) ~[janusgraph-core-1.0.0.jar:?] at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.createVertex(Attachable.java:306) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.lambda$create$10(Attachable.java:158) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.util.Attachable.attach(Attachable.java:72) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.lambda$readGraph$0(GryoReader.java:95) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.readVertexInternal(GryoReader.java:255) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.access$200(GryoReader.java:64) ~[gremlin-core-3.7.0.jar:3.7.0] at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader$VertexInputIterator.next(GryoReader.java:331) ~[gremlin-core-3.7.0.jar:3.7.0]

I used the below code to export the graph as binary which is successful. but import the same is failing with above error Export code:

mapper = GryoMapper.build().addRegistry(JanusGraphIoRegistry.instance()).create(); writer = GryoWriter.build().mapper(mapper).create(); java.util.zip.GZIPOutputStream gzOutput=new java.util.zip.GZIPOutputStream(new FileOutputStream('"+graphKryoFileName+"')); writer.writeGraph(gzOutput, graph); gzOutput.close();

Import code builder = GryoMapper.build().addRegistry(JanusGraphIoRegistry.instance()).create(); def gryoReader = GryoReader.build().mapper(builder).create() def inputFile = new FileInputStream(sout.toString().trim()) gryoReader.readGraph(inputFile, graph)