[2.0-rc1] edge creation problems with distributed setup

120 views
Skip to first unread message

Pramod N

unread,
Jan 4, 2015, 1:17:43 PM1/4/15
to orient-...@googlegroups.com
Hello,
Has anyone encountered the following problem?
Two entities linked with relation and the relation itself is defined as a class extending E. The trouble is when i fire query like this in distributed setup, it tries to overwrite the ‘from' set of records with null and fails!(constraints on the from class)

create edge CanPlay from (select from Subject where (_id=’group123’) ) to (select from Game where (_id=‘football' ))

Subject is an Abstract vertex; User and Group Extends Subject; The Subject class has _id mandatory and unique constraints.


Error: com.orientechnologies.orient.server.distributed.ODistributedException: Quorum 2 not reached for request (id=428 from=rc1-auth-local task=record_update(#13:2 v.3) userName=admin). Timeout=21ms Servers in timeout/conflict are:
 - rc1-auth-local: com.orientechnologies.orient.core.exception.OValidationException: The field 'Subject._id' is mandatory, but not found on record: Group#13:2 v3
 - rc1-auth-local3: com.orientechnologies.orient.core.exception.OValidationException: The field 'Subject._id' is mandatory, but not found on record: Group#13:2 v3
Received: {rc1-auth-local-2=com.orientechnologies.orient.core.exception.OValidationException: The field 'Subject._id' is mandatory, but not found on record: Group#13:2 v3, rc1-auth-local3=com.orientechnologies.orient.core.exception.OValidationException: The field 'Subject._id' is mandatory, but not found on record: Group#13:2 v3, rc1-auth-local=com.orientechnologies.orient.core.exception.OValidationException: The field 'Subject._id' is mandatory, but not found on record: Group#13:2 v3}

The above exception looks like a symptom than the problem.
@machinelearner

--

Luca Garulli

unread,
Jan 5, 2015, 12:54:28 AM1/5/15
to orient-database

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luca Garulli

unread,
Jan 7, 2015, 6:23:46 AM1/7/15
to orient-database
Hi Pramod,
Unfortunately OrientDB 2.0 doesn't support 100% constraints in distributed mode for the reason explained in documentation. This isn't something we can do in short term. Consider also that very few NoSQL support constraints. You have 2 alternatives to this:
  1. you could write a Hook and register it in OrientDB that catch onAfterCreate() and onAfterUpdate() events and do all the checks in Java code. In onAfterCreate() you should apply constraints only when the record has fields, otherwise skip it. This is because sometimes edge/vertex creation is created as empty and then updated
  2. avoid chained saving with graph. For example if you're creating a new edge, assure you have created and saved vertices before the edge. In this way you can't have 2 pass saving and constraints would work.
Lvc@

Pramod N

unread,
Jan 7, 2015, 8:03:53 AM1/7/15
to orient-...@googlegroups.com
Hook way, I'll try and explore. Thanks for the hint.

But the application is already very chatty with a lot of checks for existence of vertices(always queried on indexed field; assuming this does not affect the availability of the database dramatically), and the addition of edge certainly is not chained. Its isolated in a create edge query with from and two given by sub queries.

The constraint makes sense because of relation and some extent of relational integrity guarantee provided by the db. I wouldn't say its fair to compare it with other NoSQL solution's constraint capabilities.

Irrespective, it'll be interesting to hear about the rationale behind the design choice to create edge and mutate corresponding vertex during the process. You are more likely to run into version related problems if there are concurrent edge creation at load.(and the same holds for lightWeightEdges)
Sorry, my intention is not to hijack the thread in a different direction but this seems related.


Luca Garulli

unread,
Jan 7, 2015, 11:52:23 AM1/7/15
to orient-database
About the update of vertices, you can avoid it on edge creation, you should set this cfg to -1:

java ... -DridBag.embeddedToSbtreeBonsaiThreshold=-1 ...

Or in Java, before using OrientDB, with:

OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1);

Lvc@

Reply all
Reply to author
Forward
0 new messages