You don't need to open multiple instances. Simply share the instance across threads - it is thread safe.
-----Original Message----- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of paolo.forte Sent: Wednesday, July 27, 2011 9:14 AM To: user@lists.neo4j.org Subject: [Neo4j] Concurrent access to Index Hello, I'm testing neo4j (1.4) with a massive and continuous process: I have an instance of EmbeddedGraphDatabase where each node must be unique (a node identify a userid). My current problem is that when I try to open another instance of graphdb with EmbeddedReadOnlyGraphDatabase in order to query the graph (meanwhile the first instance is still inserting new data) I experienced the following error: Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /data/neo4j/metadata.db/index/lucene/node/users_id/_22j1m.cfs (No such file or directory) at org.neo4j.index.impl.lucene.LuceneDataSource.getIndexWriter(LuceneDataSource.java:601) at org.neo4j.index.impl.lucene.LuceneDataSource.getIndexSearcher(LuceneDataSource.java:484) at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:248) at org.neo4j.index.impl.lucene.LuceneIndex.get(LuceneIndex.java:187) at nosql.metadata.test.Neo4JQueryTest.main(Neo4JQueryTest.java:117) ... 5 moreCaused by: java.io.FileNotFoundException: /data/neo4j/metadata.db/index/lucene/node/users_id/_22j1m.cfs (No such file or directory) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:233) at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexInput$Descriptor.<init>(SimpleFSDirectory.java:69) at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexInput.<init>(SimpleFSDirectory.java:90) at org.apache.lucene.store.NIOFSDirectory$NIOFSIndexInput.<init>(NIOFSDirectory.java:91) at org.apache.lucene.store.NIOFSDirectory.openInput(NIOFSDirectory.java:78) at org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:66) at org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:55) at org.apache.lucene.index.IndexWriter.getFieldInfos(IndexWriter.java:1193) at org.apache.lucene.index.IndexWriter.getCurrentFieldInfos(IndexWriter.java:1213) at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1149) at org.neo4j.index.impl.lucene.LuceneDataSource.getIndexWriter(LuceneDataSource.java:588) ... 9 more I can "recover" the db index renaming the index segment (probably with loss of data) and try to recover it with CheckIndex Probably is my lack on knolodge on lucene indexing, but how can I (MULTIPLE) query in safe way the db without corrupting the lucene index segments? I also noted that if I start the server in read only mode (in order to connect to an EmbeddedGraphDatabase that continuously ingest new data) the webadmin interface doesn't update the number of nodes, edges and relationships.... are the two problems correlated? Thanks in advance for any suggestions and help. Paolo Forte As a matter of fact I would like to understand how it is possible to write and read (query in read only mode) the db. _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user