Re: [Neo4j] Node Id generation deadlock

2011-11-05 Thread Mattias Persson
You'd have to go with another solution then. Is your application this critical to write throughput or are you just thinking ahead and making sure that it some day might need to support an amount of write throughput? 2011/11/3 Yaniv Ben Yosef yani...@gmail.com Hi, I've also been wondering

Re: [Neo4j] Node Id generation deadlock

2011-11-05 Thread Rick Bullotta
] Node Id generation deadlock You'd have to go with another solution then. Is your application this critical to write throughput or are you just thinking ahead and making sure that it some day might need to support an amount of write throughput? 2011/11/3 Yaniv Ben Yosef yani...@gmail.com Hi, I've

Re: [Neo4j] Node Id generation deadlock

2011-11-05 Thread Rick Bullotta
...@lists.neo4j.org] On Behalf Of Rick Bullotta [rick.bullo...@thingworx.com] Sent: Saturday, November 05, 2011 11:24 AM To: Neo4j user discussions Subject: Re: [Neo4j] Node Id generation deadlock FWIW, you might be better off pipelining these writes through a single worker thread/queue. It helps

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Mattias Persson
Even without the synchronized ( _lock ) block your transactions would be serialized as each transaction would have to grab a lock on that factory node. So I propose you change that method implementation to: private long generateId() { // This is a workaround for grabbing a write lock

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Cres
This solution would have been ok if I had only one node created from that factory in each transaction. however, as shown in the sample code I posted in the original message, I have multiple nodes created in one transaction, and multiple such transactions in multiple threads. So while the

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Tuure Laurinolli
On Nov 2, 2011, at 13:33 , Balazs E. Pataki wrote: Hi, I had a similar issue (also with ID generation), and I would be also interested in a solution, or how synchronizations should be done to avoid deadlocks like this in the transaction. Have you considered using IDs that can be

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Balazs E. Pataki
Hi, there are times when a random ID would be OK, but I (and as I can see Ran) needed a sequentially generated ID (or sequence number). In this case, you have to persist the last ID in the DB and read-increment-store when the next ID is to be generated. But this multihreaded issue could come

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Mattias Persson
2011/11/3 Cres cre...@gmail.com This solution would have been ok if I had only one node created from that factory in each transaction. It doesn't matter... after factory.setProperty is run that transaction has got a write lock on that factory node which is held until the transaction committs.

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Cres
Mattias: I see your point, and indeed if it weren't for the deadlock, the transactions would have gotten serialized anyway, even without taking the lock by removing a fake property, since we do setProperty. However this only strengthens the question, as it further provides the need to somehow get

Re: [Neo4j] Node Id generation deadlock

2011-11-03 Thread Yaniv Ben Yosef
Hi, I've also been wondering about this subject. According to the Neo4J design guide ( http://wiki.neo4j.org/content/Design_Guide) the factory node and id generator patterns are the way to implement sequential ID generation. However, according to this thread, it sounds like in a multi-threaded

[Neo4j] Node Id generation deadlock

2011-11-02 Thread Cres
(Sorry for re-opening this thread, I hadn't yet subscribed to the mailing list when I opened it the previous time, so I had to re-start it..) Hi, I'm using Neo4J version 1.4.1. I've tried following the design guide ( http://wiki.neo4j.org/content/Design_Guide#Make_use_of_Factories ) writing a

Re: [Neo4j] Node Id generation deadlock

2011-11-02 Thread Balazs E. Pataki
Hi, I had a similar issue (also with ID generation), and I would be also interested in a solution, or how synchronizations should be done to avoid deadlocks like this in the transaction. Regards, --- balazs On 11/2/11 8:55 AM, Cres wrote: (Sorry for re-opening this thread, I hadn't yet

Re: [Neo4j] Node Id generation deadlock

2011-11-02 Thread David Montag
Hi Ran, Each thread creates 2 nodes in the same transaction. The chain of events leading to this seems to be the following: * Thread 1 creates the first node. By the time it leaves createNode(), it will have a write lock on the ID generator node. * Thread 2 creates the first node. It will try to

Re: [Neo4j] Node Id generation deadlock

2011-11-02 Thread Cres
Hi David, Thank you very much for your response. I can see now what caused the deadlock. However, I'm not really sure how I can solve this problem efficiently - as you mentioned, your proposed solution will effectively serialize my transactions. Unfortunately, it'd be very difficult for me to