Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1047

TinkerGraph GraphSON storage format broken

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Implemented
    • 3.0.2-incubating
    • 3.1.1-incubating
    • io
    • None

    Description

      Opening a TinkerGraph, that is stored in GraphSON format, doesn't reset the internal id counter.

      gremlin> configuration = new BaseConfiguration()
      ==>org.apache.commons.configuration.BaseConfiguration@b8a7e43
      gremlin> configuration.setProperty(Graph.GRAPH, "org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph")
      ==>null
      gremlin> configuration.setProperty("gremlin.tinkergraph.graphLocation", "/tmp/graph.graphson")
      ==>null
      gremlin> configuration.setProperty("gremlin.tinkergraph.graphFormat", "graphson")
      ==>null
      gremlin> mygraph = GraphFactory.open(configuration)
      ==>tinkergraph[vertices:0 edges:0]
      gremlin> mygraph.addVertex()
      ==>v[0]
      gremlin> mygraph.close()
      ==>null
      gremlin> mygraph = GraphFactory.open(configuration)
      ==>tinkergraph[vertices:1 edges:0]
      gremlin> mygraph.addVertex()
      ==>v[0]
      gremlin> mygraph.close()
      ==>null
      gremlin> mygraph = GraphFactory.open(configuration)
      GraphFactory could not instantiate this Graph implementation [class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph]
      Display stack trace? [yN] y
      java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph]
      	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:82)
      	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
      	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory$open.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)
      	at groovysh_evaluate.run(groovysh_evaluate:3)
      	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
      	at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:69)
      	at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:185)
      	at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:119)
      	at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:94)
      	at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
      	at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
      	at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:123)
      	at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:58)
      	at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
      	at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:82)
      	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
      	at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:144)
      	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
      	at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:303)
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:78)
      	... 37 more
      Caused by: java.lang.RuntimeException: Could not load graph at /tmp/graph.graphson with graphson
      	at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.loadGraph(TinkerGraph.java:289)
      	at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.<init>(TinkerGraph.java:157)
      	at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.open(TinkerGraph.java:186)
      	... 42 more
      Caused by: java.lang.IllegalArgumentException: Vertex with id already exists: 0
      	at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.vertexWithIdAlreadyExists(Graph.java:1116)
      	at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.addVertex(TinkerGraph.java:199)
      	at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.createVertex(Attachable.java:291)
      	at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.lambda$create$20(Attachable.java:149)
      	at org.apache.tinkerpop.gremlin.structure.util.Attachable.attach(Attachable.java:63)
      	at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.lambda$readGraph$93(GraphSONReader.java:105)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.Iterator.forEachRemaining(Iterator.java:116)
      	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
      	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
      	at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader.readGraph(GraphSONReader.java:103)
      	at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo.readGraph(GraphSONIo.java:86)
      	at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.loadGraph(TinkerGraph.java:282)
      	... 44 more
      gremlin> 
      

      I just discovered this bug in the current master/. Previous versions might be affected as well.

      Attachments

        Activity

          People

            spmallette Stephen Mallette
            dkuppitz Daniel Kuppitz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: