Why do you need the unique constraint?

On Mon, Feb 10, 2014 at 9:52 PM, Michael Hunger <
[email protected]> wrote:

> I think you have to change it to use merge which takes a schema index lock.
>
> ie.
>
> create constraint on (h:HEAD) assert h.list is unique;
>
> MERGE (headNode:HEAD {list:"mylist"})
>
>    MATCH (headNode)-[old:LINK]->after
>
> DELETE old
> CREATE headNode-[:LINK]->(newNode:LINKNODE { number : {nodeNumber}
> })-[:LINK]->after
>
>
>
> HTH
>
> Michael
>
> Am 10.02.2014 um 11:30 schrieb Aran Mulholland <[email protected]>:
>
> I've got some real headaches inserting into linked lists.
>
> If I create a node as such:
>
> CREATE (headNode:HEAD)-[:LINK]->(headNode)
>
> then insert like so
>
> MATCH (headNode:HEAD)-[old:LINK]->after
> DELETE old
> CREATE headNode-[:LINK]->(newNode:LINKNODE { number : {nodeNumber}
> })-[:LINK]->after
>
> then everything is fine and dandy. But when I try to run the insertion
> code in parallel, then I get some real issues. I either get an error like
> "Relationship 325457 not found" or I get two or more lists coming off the
> headNode. The first error I can deal with as I can rerun the query, the
> second is totally unacceptable as my other queries get very messed up
> results.
>
> I am writing for a twitter like service and am using the linked lists so I
> can have a news feed. There is a high possibility that the list will need
> to be added to by more than one user at once, and this chance will grow the
> more users the system has.
>
> What I want to be able to do is put a lock around the insertion so that
> this does not happen.
>
> How can I better craft my queries so that parallel insertion via cypher
> over REST is sustainable?
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to