Great! I was just about to ask for some test code. You can either send
it directly to me or here to the list. Another option is to upload it
to http://trac.neo4j.org if you create a ticket for the problem.

-Johan

On Thu, Nov 12, 2009 at 1:40 PM, Daniel Martínez
<[email protected]> wrote:
> Hello,
>
> I have created a small test in java demonstrating this use case. If it
> is useful for you, please tell me where to upload/send it.
>
> Regards,
> --
> Daniel Martínez
>
> El mié, 11-11-2009 a las 17:10 +0100, Daniel Martínez escribió:
>
>> Hi and thanks for the answer,
>>
>> By close transaction I mean commit. The code as it is does not share
>> transactions.
>>
>> The problematic use case is:
>>
>> T1 begin
>>  create rel 0 -> 1
>> T1 commit
>> T1 begin
>>  create rel 1 -> 2
>> T2 begin
>>  create rel 0 -> 3  <<<<<< deadlock
>>  set property 3
>> T2 commit
>> T1 set property 2
>> T1 commit
>>
>> The case that works (with 0 -> 1 and 0 -> 3 already created):
>>
>> T1 begin
>>  obtain 0 -> 1
>>  obtain 1
>> T1 commit
>> T1 begin
>>  create rel 1 -> 2
>> T2 begin
>>  obtain 0 -> 3
>>  set property 3
>> T2 commit
>> T1 set property 2
>> T1 commit
>>
>> The goal is having 0 -> 1 -> 2 and 0 -> 3 created. I suspect the problem
>> lies within node 0. Is it possible that T1 locks 0 when creating 1 -> 2?
>>
>> Regards,
>> --
>> Daniel Martínez
>>
>>
>> El mié, 11-11-2009 a las 14:13 +0100, Johan Svensson escribió:
>>
>> > 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
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to