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. Pramod N <http://atmachinelearner.blogspot.in> @machinelearner <https://twitter.com/machinelearner> -- On Wed, Jan 7, 2015 at 4:53 PM, Luca Garulli <[email protected]> wrote: > 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@ > > > On 5 January 2015 at 06:54, Luca Garulli <[email protected]> wrote: > >> Hi, >> Look at: >> >> >> http://www.orientechnologies.com/docs/last/orientdb.wiki/Graph-Schema.html#constraints >> >> Lvc@ >> >> >> On 4 January 2015 at 19:17, Pramod N <[email protected]> wrote: >> >>> 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. >>> >>> Pramod N <http://atmachinelearner.blogspot.in> >>> @machinelearner <https://twitter.com/machinelearner> >>> >>> -- >>> >>> -- >>> >>> --- >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- > > --- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
