Hi, There is no global lock in Neo4j. We lock on a relationship and node level so:
create node - write lock on created node (so other tx can't see until it exist for real) set/remove property - write lock on either the node or relationship create / delete relationship - write lock on the relationship and both nodes it is connected to There is however a special case during relationship create/delete. For a short period of time (during commit) a write lock may be grabbed on some other relationship (connected to the same node) while updating the "dual interleaved linked list" storing the relationships. I could not quite understand the use case you describe. By close you mean commit/rollback or suspend of transaction? If close means commit I get: T1 begin create rel 0 -> 1 T1 commit T1 begin create rel 1->2 T2 begin setProperty 2 // this will block since other open tx has created relationship to node 2 When T1 commits T2 can continue. Regards, -Johan On Wed, Nov 11, 2009 at 12:57 PM, Daniel Martínez <[email protected]> wrote: > Hi everyone, > > I am currently testing neo4j (1.0-b9)as a persistence layer for an app. > I have encountered an strange problem. > > I have two threads creating relations at the same time (both open > transactions) > > (0 is root node) > > T1(main): Begin transaction --> create relationship 0 -> 1 --> Close > Transaction --> Begin transaction --> create relationship 1 -> 2 --> > create T2 --> wait for T2 --> set property 2 --> .... --> Close > Transaction --> .... > T2: Begin transaction --> create relationship 0 -> 3 --> set property 3 > --> Close Transaction > > T1 is waiting for T2 to end, but it never does because of a deadlock. > Why is there such a deadlock? The nodes are not the same (concurrent > transactions for 1->2 and 0->3 creation). > > This does not occur during this situation > (0->1, 0->3 exist in database, 0 is root node) > > T1(main): Begin transaction --> obtain node 1 --> Close Transaction --> > Begin transaction --> create relationship 1->2 --> create T2 --> wait > for T2 --> set property 2 --> .... --> Close transaction --> .... > T2: Begin transaction --> Obtain 3 --> set property 3 --> Close > Transaction > > In this case both transactions commit correctly. > > Is there a global lock in neo4j when creating relationships? > > Thanks for your help, > -- > Daniel Martínez _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

