To assure uniqueness across multiple threads and a cluster (with appropriate locks, please use MERGE)
MERGE (n:SEGMENT {segmentId : 110484}) ON CREATE SET n.name = "name" , ....; On Tue, Sep 16, 2014 at 11:15 PM, Saad Mufti <saad.mu...@gmail.com> wrote: > Hi, > > We have a Neo4J 2.1.3 database and we have a uniqueness constraint that > was created as follows: > > CREATE CONSTRAINT ON (segment:SEGMENT) ASSERT segment.segmentId IS UNIQUE > > When we test this from the browser, it works fine in detecting violations, > e.g: > > CREATE (n:SEGMENT {name : "duplicate", segmentId : 110484}) RETURN n > > results in > > Node 589 already exists with label SEGMENT and property "segmentId"=[110484] > > Neo.ClientError.Schema.ConstraintViolation > > which is fine. > > We have a load tester setup with 3 machines and multiple threads per box > using Cypher over REST talking to Neo4J and using the transactional > endpoints to do creates similar to above (but of course many more > properties relevant to our app), and always writing to the Neo4J master in > an HA setup. > > We can reliably reproduce in that setup multiple violations of the > uniqueness constraint that are NOT caught by Neo4J, they execute without > error and in the resulting db we can see multiple nodes with the SEGMENT > label and the same value for the segmentId property (we are intentionally > generating duplicate segmentId values for our test). > > Anyone else run into the same issue? Is this a Neo4J bug? > > Thanks. > > ----- > Saad > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.