orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index not updated?

rtfpessoa opened this issue · comments

We just experienced a weird case where we are using an UNIQUE index with two properties and sometimes the query returns empty but if we remove the index the query returns the value. Seems like the index is not being updated correctly? Any ideas?

hi @rtfpessoa

how can i reproduce it?

We are inserting a large quantity of data with the same structure as before, one class with two fields and then the two are used in the index. (in the future it can have more fields)


CREATE CLASS V_Class1 EXTENDS V;
CREATE PROPERTY V_Class1.field1 Long (MANDATORY TRUE);
CREATE PROPERTY V_Class1.field2 String (MANDATORY TRUE);
CREATE INDEX V_Class1_field1_field1_index ON V_Class1 (field1, field2) UNIQUE;

then we do this query before inserting a value in the db:

    graph.V.`match`(
      __.as("c").hasLabel("Class1"),
      __.as("c").has("field1", "value1"),
      __.as("c").has("field2", "value2")
    )
      .select[Vertex]("c")
      .headOption()

If we do not get the value we create the vertex.
With the index "sometimes" it fails because is trying to insert a value that already exists.

hi @rtfpessoa

which version are you using of the OrientDB Gremlin driver?

I think the latest version for orientdb 2 stable which is "com.michaelpollmeier" % "orientdb-gremlin" % "3.2.3.0"

Is there any more recent version?

@rtfpessoa

Maybe it could be related to #135

If you remove the index all works fine?

Is your importer MultiThread?

Maybe is related to 135. My importer is single threaded at the moment. Do you have any suggestions of more stable ways to interact with OrientDB from Java/Scala?

@rtfpessoa

For now the support of multiple field index is not optimal
Most of the work has been done in the develop branch for this driver. Since the official support will start with OrientDB 3.0
http://orientdb.com/orientdb-officially-supports-tinkerpop-3/

If you can provide some script to reproduce we can work on a fix in master branch

Otherwise you can use the Official JAVA APIs for OrientDB 2.2.x

https://orientdb.com/docs/2.2/Java-API.html

@rtfpessoa

are you using gremlin-scala ?

I am currently using gremlin-scala