Duplicate Vertex


kumkar.dev@...
 
Edited

Hello

We are on Janus 0.4.0 and faced one scenario wherein there were duplicate vertices created. 
These 2 vertices were created in span of 9 milliseconds within single transaction.
We are using index for looking up V in the graph.

The vertex is identified by 2 identifiers/properties prop1, prop2 and there are other properties.
There are property matches to check if the vertex is already present then accordingly create or update the vertex. 

There are two property matches to check for vertex existence.
  1. Match1 = prop1
  2. Match2 = prop1 OR prop2

The first vertex got created with property match, t1
  • prop1='value-foo'
The second vertex got created with property match, t1+9 milliseconds
  • prop1='value-foo' OR prop2='value-bar'
The second instance was not able to find there is a vertex with prop1='value-foo' already created before 9 milliseconds.
Could this be issue not able to read in-memory cache? Are there known issues in this area where index is not being returned resulting into this issue? 

Thanks
Dev


Boxuan Li
 

Hi, can you share more details (what indexes do you have related to prop1 and/or prop2), or even minimal code to reproduce? 

On Mar 19, 2021, at 12:32 AM, kumkar.dev@... wrote:

Hello

We are on Janus 0.4.0 and faced one scenario wherein there were duplicate vertices created. 
These 2 vertices were created in span of 9 milliseconds within single transaction.
We are using index for looking up V in the graph.

The vertex is identified by 2 identifiers/properties prop1, prop2 and there are other properties.
There are property matches to check if the vertex is already present then accordingly create or update the vertex. 

There are two property matches to check for vertex existence.
  1. Match1 = prop1
  2. Match2 = prop1 OR prop2

The first vertex got created with property match, t1
  • prop1='value-foo'
The second vertex got created with property match, t1+9 milliseconds
  • prop1='value-foo' OR prop2='value-bar'
The second instance was not able to find there is a vertex with prop1='value-foo' already created before 9 milliseconds.
Could this be issue not able to read in-memory cache? Are there known issues in this area where index is being returned resulting into this issue? 

Thanks
Dev


kumkar.dev@...
 

Hi Boxuan Li,

Hope this helps:
---------------------------------------------------------------------------------------------------
Vertex Index Name              | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
by_prop1                       | Composite   | false     | internalindex  | prop1:        ENABLED |
by_prop2                       | Composite   | false     | internalindex  | prop2  :      ENABLED |

- Dev


Boxuan Li
 

I couldn't reproduce this on the v0.4 branch using the below code:


@Test
public void testTopic81433493() {
PropertyKey prop1 = mgmt.makePropertyKey("prop1").dataType(String.class).make();
PropertyKey prop2 = mgmt.makePropertyKey("prop2").dataType(String.class).make();
mgmt.buildIndex("comp1", Vertex.class).addKey(prop1).buildCompositeIndex();
mgmt.buildIndex("comp2", Vertex.class).addKey(prop2).buildCompositeIndex();
finishSchema();

tx.addVertex("prop1", "value-foo");
assertTrue(tx.traversal().V().has("prop1", "value-foo").hasNext());
assertTrue(tx.traversal().V().or(__.has("prop1", "value-foo"), __.has("prop2", "value-bar")).hasNext());
}