On Sun, Jun 24, 2012 at 11:59 AM, Yaron Naveh <yaron
...@gmail.com> wrote:
> Thanks
> I still don't get the problem. I have node A with links to different nodes.
> I delete the links. There should be no deadlock in my scenario. Possibly A
> will be locked for a while by one delete, by why don't other deletes wait
> for the lock to be released?
> Also can you give me a link for batch transactions?
> On Sun, Jun 24, 2012 at 5:19 AM, Michael Hunger
> <michael.hun...@neotechnology.com> wrote:
>> Deleting a relationship currently locks both nodes.
>> What about deleting them all in a batch transaction?
>> Or deleting them with mutating cypher?
>> http://docs.neo4j.org/chunked/snapshot/query-delete.html
>> MIchael
>> Am 24.06.2012 um 00:44 schrieb Yaron Naveh:
>> Thanks
>> Actually I have a node X, and multiple nodes a..z that are linked to it. I
>> am deleting all links. Since all links are different (except their end point
>> X) I'm not sure how deleting one link should lock another?
>> what does it mean to do it on the server side?
>> not sure how how to handle it externally - if I have multiple clients on
>> different machines I cannot synchronize them. I am expecting neo4j to lock
>> everything of interest while deleting a link.
>> On Sat, Jun 23, 2012 at 10:52 PM, Florent Empis <florent.em...@gmail.com>
>> wrote:
>>> (Answering this with very partial knowledge, I use this as an occasion to
>>> learn stuff about Neo4J)
>>> In 2009, similar issues arose (
>>> http://www.mail-archive.com/u...@lists.neo4j.org/msg01870.html )
>>> The advice given then was to manage the locking mechanism by hand.
>>> Looking at your trace, I'd say that your data is like this:
>>> (Node X) -[Rel 8253]-(Node 1841)
>>> You are currently trying to delete node X.
>>> Sometime before, you ran an operation (a delete I guess?) on node 1841
>>> To be able to perform this, Relationship 8253 has to be locked (it will
>>> be deleted, since per
>>> http://docs.neo4j.org/chunked/milestone/transactions-delete.html all
>>> properties and relationships of a node are deleted upon delete of the node
>>> itself)
>>> When you do it in synch mode:
>>> You: Delete Node 1841
>>> You: Wait
>>> Server: Delete confirmed
>>> You: Delete Node X
>>> Works, obviously
>>> When you do it in asynch mode:
>>> What you are attempting to do is:
>>> You:Delete Node 1841
>>> Server:Locks Node 1841 and all its relationships
>>> You:Delete Node X
>>> Server:Attemps to lock 1841 and all its relationships: fails on rel 8253
>>> Server:Boom, Err 500 on delete Node X
>>> Server:(probably) Delete Node 1841 confirmed
>>> Either you can manage the lock on the server side like suggested in the
>>> 2009 thread, or I think you'll have to manage it externally.
>>> Can you add some sort of management in your delete calls to the server,
>>> partionning it to avoid collisions? Something akin to this:
>>> [0...33][34...66][67...99]
>>> (this example assumes that relationships are all between direct
>>> neighbours of course...)
>>> 3 threads run in parallel.
>>> Thread A starts at 0 stops at 33
>>> Thread B starts at 66 stops at 34
>>> Thread B starts at 99 stops at 67
>>> This should in theory avoid collisions if we assume delete operation
>>> duration to be constant for all nodes...?
>>> (if you want to be extra careful, add a dampenning at the end of the
>>> partition: as you get closer to the boundary, wait a little bit between
>>> calls...it will give extra time to the neighbouring thread to move further
>>> away....)
>>> Please remember I'm probably as new to Neo4J as you, so take all this
>>> with a grain of salt :-)
>>> Florent
>>> 2012/6/23 Yaron Naveh <yaron...@gmail.com>
>>>> Hi
>>>> I'm using neo4j 1.8 using node-neo4j (which uses the REST api of neo4j).
>>>> I need to delete 100 nodes. When I do this synchronously there is no
>>>> problem (e.g. I wait for one delete to finish before calling the next one).
>>>> When I delete them in an async manner (many rest requests sent
>>>> concurrently) I intermittently get a few failures. I see this coming back in
>>>> the http response once per each error:
>>>> HTTP/1.1 500 Transaction(15744)[STATUS_ACTIVE,Resources=1] can't wait on
>>>> resource RWLock[Relationship[8253]] since =>
>>>> Transaction(15744)[STATUS_ACTIVE,Resources=1] <-[:HELD_BY]-
>>>> RWLock[Node[1841]] <-[:WAITING_FOR]-
>>>> Transaction(15744)[STATUS_ACTIVE,Resources=1] <-[:HELD_BY]-
>>>> RWLock[Relationship[8253]]
>>>> Content-Length: 0
>>>> Server: Jetty(6.1.25)
>>>> I believe neo4j uses keep-alive to reuse the same connection but this
>>>> does not seem relevant. I have verified my code is (logically) correct, e.g.
>>>> I do not delete an already deleted node and etc.
>>>> Any idea?
>>>> Thanks,
>>>> Yaron
>> --
>> I'm on Twitter (@YaronNaveh)
> --
> I'm on Twitter (@YaronNaveh)