You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Justin Swanhart <gr...@gmail.com> on 2004/10/02 01:13:43 UTC

multiple threads

As I understand it, if two writers try to acess the same index for
writing, then one of the writers should block waiting for a lock until
the lock timeout period expires, and then they will return a "Lock
wait timeout" exception.

I have a multithreaded indexing applications that writes into one of
multiple indexes depending on a hash value, and I intend to merge all
the hashes when the indexing finishes.  Locking usually works but
sometimes it doesn't and I get IO exceptions such as the following..

java.io.IOException: Cannot delete _19.fnm
        at org.apache.lucene.store.FSDirectory.deleteFile(FSDirectory.java:198)
        at org.apache.lucene.index.SegmentMerger.createCompoundFile(SegmentMerger.java:157)
        at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:100)
        at org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:487)
        at org.apache.lucene.index.IndexWriter.optimize(IndexWriter.java:366)
        at org.apache.lucene.index.IndexWriter.addIndexes(IndexWriter.java:389)
        at org.en.global.indexer.IndexGroup.run(IndexGroup.java:387)


Any idea on why this could be happening?  I am using NFS currently,
but the problem appears on the local filesystem as well.

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: multiple threads

Posted by Aviran <am...@infosciences.com>.
You should not have more then one IndexWriter. (You can have multiple
IndexReaders, but only one IndexWriter).

Aviran


-----Original Message-----
From: Justin Swanhart [mailto:greenlion@gmail.com] 
Sent: Friday, October 01, 2004 19:14 PM
To: lucene-user@jakarta.apache.org
Subject: multiple threads


As I understand it, if two writers try to acess the same index for writing,
then one of the writers should block waiting for a lock until the lock
timeout period expires, and then they will return a "Lock wait timeout"
exception.

I have a multithreaded indexing applications that writes into one of
multiple indexes depending on a hash value, and I intend to merge all the
hashes when the indexing finishes.  Locking usually works but sometimes it
doesn't and I get IO exceptions such as the following..

java.io.IOException: Cannot delete _19.fnm
        at
org.apache.lucene.store.FSDirectory.deleteFile(FSDirectory.java:198)
        at
org.apache.lucene.index.SegmentMerger.createCompoundFile(SegmentMerger.java:
157)
        at
org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:100)
        at
org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:487)
        at
org.apache.lucene.index.IndexWriter.optimize(IndexWriter.java:366)
        at
org.apache.lucene.index.IndexWriter.addIndexes(IndexWriter.java:389)
        at org.en.global.indexer.IndexGroup.run(IndexGroup.java:387)


Any idea on why this could be happening?  I am using NFS currently, but the
problem appears on the local filesystem as well.

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org