[Neo4j] Database left in locked state when an exception is thrown during upgrade

2012-01-11 Thread Paul A. Jackson
This is not a huge deal, since the real problem is that the database cannot be 
updated, but I thought I would share in case this can occur in other scenarios.

In my case, I have a database that I created with build 1.5m02 that I am 
opening with release 1.5. According to the error message, I must not have shut 
down the database properly prior to upgrade. If I attempt this a second time in 
the same process I get a different exception that implies the database is still 
locked. It seems to me like this operation should have been attempted inside a 
try block with a finally block that performs an unlock. Here are the stack 
traces:

First attempt:
Caused by: org.neo4j.graphdb.TransactionFailureException: Could not create data 
source [nioneodb], see nested exception for cause of error
 at 
org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:158)
 at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:105)
 at 
org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:190)
 at 
org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:80)
 at com.g1.dcg.graph.neo4j.NeoGraph.init(NeoGraph.java:128)
 ... 43 more
Caused by: java.lang.IllegalStateException: Mismatching store version found 
(Uknown while expecting v0.A.0) and the store is not cleanly shutdown. Recover 
the database with the previous database version and then attempt to upgrade
 at 
org.neo4j.kernel.impl.nioneo.store.NeoStore.checkVersion(NeoStore.java:125)
 at 
org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:104)
 at 
org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120)
 at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:78)
 at 
org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:165)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at 
org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:77)
 at 
org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:152)
 ... 47 more

Second attempt in same process:
Caused by: org.neo4j.graphdb.TransactionFailureException: Could not create data 
source [nioneodb], see nested exception for cause of error
 at 
org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:158)
 at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:105)
 at 
org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:190)
 at 
org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:80)
 at com.g1.dcg.graph.neo4j.NeoGraph.init(NeoGraph.java:128)
 ... 43 more
Caused by: java.lang.IllegalStateException: Unable to lock store 
[E:\Spectrum\server\modules\graph\db\graph\neostore], this is usually a result 
of some other Neo4j kernel running using the same store.
 at 
org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.checkStorage(CommonAbstractStore.java:175)
 at 
org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:103)
 at 
org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120)
 at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:78)
 at 
org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:165)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at 
org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:77)
 at 
org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:152)
 ... 47 more



Paul Jackson, Principal Software Engineer
Pitney Bowes Business Insight
4200 Parliament Place | Suite 600 | Lanham, MD  20706-1844  USA
O: 301.918.0850 | M: 703.862.0120 | www.pb.com
paul.jack...@pb.com 
 
Every connection is a new opportunity(tm)
 
 
 
Please consider the environment before printing or forwarding this email. If 
you do print this email, please recycle the paper.
 
This email message may contain confidential, proprietary and/or privileged 
information. It is intended only for the use of the intended recipient(s). If 
you have received it in error, please immediately advise the sender by reply 
email and then delete this email message. Any disclosure, copying, distribution 
or use of the information 

Re: [Neo4j] Database left in locked state when an exception is thrown during upgrade

2012-01-11 Thread Peter Neubauer
Paul,
I think this is fixed in SNAPSHOT, and 1.6.M03 is coming out this week
hopefully. Could you please try after the release?

Cheers,

/peter neubauer

Google:    neubauer.peter
Skype:     peter.neubauer
Phone:     +46 704 106975
LinkedIn:  http://www.linkedin.com/in/neubauer
Twitter:    @peterneubauer
Tungle:    tungle.me/peterneubauer

brew install neo4j  neo4j start
heroku addons:add neo4j



On Wed, Jan 11, 2012 at 5:37 PM, Paul A. Jackson paul.jack...@pb.com wrote:
 This is not a huge deal, since the real problem is that the database cannot 
 be updated, but I thought I would share in case this can occur in other 
 scenarios.

 In my case, I have a database that I created with build 1.5m02 that I am 
 opening with release 1.5. According to the error message, I must not have 
 shut down the database properly prior to upgrade. If I attempt this a second 
 time in the same process I get a different exception that implies the 
 database is still locked. It seems to me like this operation should have been 
 attempted inside a try block with a finally block that performs an unlock. 
 Here are the stack traces:

 First attempt:
 Caused by: org.neo4j.graphdb.TransactionFailureException: Could not create 
 data source [nioneodb], see nested exception for cause of error
     at 
 org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:158)
     at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:105)
     at 
 org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:190)
     at 
 org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:80)
     at com.g1.dcg.graph.neo4j.NeoGraph.init(NeoGraph.java:128)
     ... 43 more
 Caused by: java.lang.IllegalStateException: Mismatching store version found 
 (Uknown while expecting v0.A.0) and the store is not cleanly shutdown. 
 Recover the database with the previous database version and then attempt to 
 upgrade
     at 
 org.neo4j.kernel.impl.nioneo.store.NeoStore.checkVersion(NeoStore.java:125)
     at 
 org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:104)
     at 
 org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120)
     at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:78)
     at 
 org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:165)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at 
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at 
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at 
 org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:77)
     at 
 org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:152)
     ... 47 more

 Second attempt in same process:
 Caused by: org.neo4j.graphdb.TransactionFailureException: Could not create 
 data source [nioneodb], see nested exception for cause of error
     at 
 org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:158)
     at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:105)
     at 
 org.neo4j.kernel.EmbeddedGraphDbImpl.init(EmbeddedGraphDbImpl.java:190)
     at 
 org.neo4j.kernel.EmbeddedGraphDatabase.init(EmbeddedGraphDatabase.java:80)
     at com.g1.dcg.graph.neo4j.NeoGraph.init(NeoGraph.java:128)
     ... 43 more
 Caused by: java.lang.IllegalStateException: Unable to lock store 
 [E:\Spectrum\server\modules\graph\db\graph\neostore], this is usually a 
 result of some other Neo4j kernel running using the same store.
     at 
 org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.checkStorage(CommonAbstractStore.java:175)
     at 
 org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.init(CommonAbstractStore.java:103)
     at 
 org.neo4j.kernel.impl.nioneo.store.AbstractStore.init(AbstractStore.java:120)
     at org.neo4j.kernel.impl.nioneo.store.NeoStore.init(NeoStore.java:78)
     at 
 org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.init(NeoStoreXaDataSource.java:165)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at 
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at 
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at 
 org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:77)
     at 
 org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:152)
     ... 47 more



 Paul Jackson, Principal Software Engineer
 Pitney Bowes Business Insight
 4200 Parliament Place | Suite 600 | Lanham, MD  20706-1844  USA
 O: 301.918.0850 | M: 703.862.0120 | www.pb.com