Date
1 - 3 of 3
Gremlin giving stale response
Aman <amandeep.srivastava1996@...>
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 |
|
hadoopmarc@...
Hi Aman,
Without saying that I understand everything of the JanusGraph behaviour that you describe, I can add the following:
|
|
Aman <amandeep.srivastava1996@...>
Hi Marc, Using read-only strategy is a really good suggesion. Let me try that, thanks! Regards, Aman On Tue, 15 Mar, 2022, 12:45 pm , <hadoopmarc@...> wrote: Hi Aman, |
|