Hi, Johan. Is this related to the patch you provided me for a similar issue? I had thought it made it into the milestone release(s).
Thanks, Rick -------- Original Message -------- Subject: Re: [Neo4j] InvalidRecordException exception From: Johan Svensson <[1][email protected]> Date: Wed, December 15, 2010 8:32 am To: Neo4j user discussions <[2][email protected]> This will still happen in the 1.2.M05 release. I just wanted to make sure I linked the stacktrace's line numbers to the right part of the code since that exception being thrown at a different place in the delete method could mean there are other problems. -Johan On Wed, Dec 15, 2010 at 1:42 PM, George Ciubotaru <[3][email protected]> wrote: > Yes, the version I'm currently using is 1.1. Shall I understand that this kind of issue shouldn't occur in 1.2.M05? > > For the moment I'll take the pessimistic approach by guarding against (as in the example you gave) to assure that this is the reason and then I'll just accept the exception. > > Thank you for your quick and detailed response. > > Best regards, > George > > > -----Original Message----- > From: [4][email protected] [[5]mailto:[email protected]] On Behalf Of Johan Svensson > Sent: 15 December 2010 12:23 > To: Neo4j user discussions > Subject: Re: [Neo4j] InvalidRecordException exception > > Sorry, should also have asked what Neo4j version you use but guessing it is 1.1 or early milestone release? > > If so I think the problem is caused by two or more concurrent transactions running delete on the same relationship. If two transactions get a reference to the same relationship and concurrently delete that relationship it is possible for a InvalidRecordException to be thrown instead of a NotFoundException since the write lock is grabbed after the relationship has been verified to exist. > > Solution is either to accept the exception or to guard against it by first acquiring a read lock on the relationship before invoking relationship.delete(). Code example how to do this: > > GraphDatabaseService gdb; // the graph db > Relationship relationship; // the relationship to delete > > LockManager lockManager = ((EmbeddedGraphDatabase) gdb).getConfig().getLockManager(); > lockManager.getReadLock( relationship ); > try > { > relationship.delete(); > } > finally > { > lockManager.releaseReadLock( relationship ); > } > > Regards, > Johan > _______________________________________________ Neo4j mailing list [6][email protected] [7]https://lists.neo4j.org/mailman/listinfo/user References 1. mailto:[email protected] 2. mailto:[email protected] 3. mailto:[email protected] 4. mailto:[email protected] 5. mailto:[email protected] 6. mailto:[email protected] 7. https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

