Gremlin-server: does vertexIdManager=ANY generates id collisions?
Solution 1:
The reason you may not see sequential IDs is that properties also have IDs and in the case of TinkerGraph, are taken from the same pool. You can see this using the Gremlin Console locally also.
gremlin> conf = new BaseConfiguration();[]
gremlin> conf.setProperty("gremlin.tinkergraph.vertexIdManager","ANY");[]
gremlin> conf.setProperty("gremlin.tinkergraph.edgeIdManager","ANY");[]
gremlin> conf.setProperty("gremlin.tinkergraph.vertexPropertyIdManager","ANY");[]
gremlin> g = TinkerGraph.open(conf).traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV('test')
==>v[0]
gremlin> g.addV('test')
==>v[1]
gremlin> g.addV('test').property('x',1)
==>v[2]
gremlin> g.addV('test')
==>v[4]
gremlin> g.V().has('x').properties('x').id()
==>3
Updated 2022/01/16 To address additional questions in comments.
A file (JSON or GraphML) loaded using g.io
can contain user provided IDs. These will work unless the ID is already in use. Duplicate IDs are not allowed and an error will be thrown should any be encountered. Only properties will be automatically given IDs during file loading.