Hi,
I've built a service around JanusGraph to ingest/retrieve data. When I ingest a new edge, the same is not reflected on the gremlin endpoint of JG. However, ingested vertices count is updated correctly.
Here's what I'm doing:
1. Use API to create 2 new vertices
2. Use API to create a new edge
3. Hit gremlin API to get vertex count -> shows 2 correctly
4. Hit gremlin API to get edge count -> shows 0
When I restart gremlin server, I'm able to see correct edge count via gremlin API (i.e. 1 in above example). My hunch is that gremlin API is using a stale transaction somewhere, hence returning incorrect data.
I tried setting 2 values of g in empty-sample.groovy:
1. globals << [g: graph.traversal()] -> This seems to give the correct number of vertices and edges always, so no issues with this one.
2. globals << [g: graph.buildTransaction().readOnly().start().traversal()] -> This seems to be having the above mentioned inconsistency issue.
I want the gremlin API to be read-only so all ingestions happen via my custom built APIs (I validate a few things before persisting data). Had following questions:
1. Why does the second value of g cause inconsistent results only for edges? If it's continuing on the same transaction, shouldn't staleness disrupt vertex count results too?
2. How can I set g value such that traversals are always readOnly and every request starts a new transaction, ending it after response has been returned to the clients.
Would appreciate it if the group can provide inputs.
Regards,
Aman