0.5.3 Upsert and RemoveRelation Issues
sammy.jia@...
Hello,
I am using Java and JanusGraph 0.5.3, but I am having issues with a specific snippet of code. The code upserts a vertex and then adds a Cardinality.single property to the upserted vertex, even if the vertex already has the correct property value. The code snippet is provided at the bottom of this message. The code works fine for inserted vertices, but it generates an IllegalArgumentException for updated vertices. The exception is being generated by StandardJanusGraphTx.java's removeRelation method. After some debugging, I discovered that the exact same property step is being called twice for updated vertices. The first property method call uses removeRelation to delete the old property from the updated vertex. The second property method call then uses removeRelation to delete the exact same old property as the first method call (they share the same ID). Strangely, the old property still thinks it is in the 'loaded' state. Midway through removeRelation, the server realizes that that the property has already been deleted, updates the property's lifecycle to 'removed' at roughly StandardJanusGraphTx.java:595, and throws an exception at StandardJanusGraphTx.java:602. P.S. In this specific case, I was replacing a property with the exact same value. Eg. the updated vertex already has a property called "prop3" with the value "value3", but I am calling property("prop3", "value3") anyways without checking the vertex's state. I have three main questions: 1. Why is the property step being called twice? 2. Does JanusGraph allow you to update a Cardinality.single property twice? 3. Why does removeRelation generate a generic IllegalArgumentException when we delete something that has already been deleted? Shouldn't it just output a log and exit the method? --- GraphTraversal<Vertex, Vertex> graphTraversal = null; for (….) { if (graphTraversal == null) { graphTraversal = graphTraversalSource.V().has("prop1", "value1").fold() .coalesce(__.unfold(), __.addV("label") .property("prop1", "value1") .property("prop2", "value2"));
} else { graphTraversal.V().hasLabel("label").has("prop1", "value1").fold() .coalesce(__.unfold(), __.addV("label") .property("prop1", "value1") .property("prop2", "value2")); } graphTraversal.property("prop3", "value3"); // this is somehow being called twice } |
|
Boxuan Li
Hi,
toggle quoted message
Show quoted text
Thanks for reporting and investigating! To help us understand more about the context, would you mind sharing an isolated code snippet that is runnable and can reproduce the error? I was trying to reproduce issue but failed to do so.
Thanks,
Boxuan
|
|
sammy.jia@...
I tried to create a snippet but was unable to reproduce the error. I will have to consult with some people over the weekday. Apologies, creating the snippet may take a bit of time.
In the meantime, do you happen to know the answer to the last question? Is it simply a design choice, or would JanusGraph stop working properly if it exited the method without generating an exception? |
|
Boxuan Li
Thanks Sammy. Regarding your last question, I believe it’s a design choice to let user know something wrong happened.
toggle quoted message
Show quoted text
|
|