lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Townsend" <david.towns...@magus.co.uk>
Subject Multiple Creation of Writers
Date Wed, 14 Jan 2004 17:48:41 GMT
In my system indices are created and updated by multiple threads.  I need to check if an index
exists to decide whether to pass true or false to the IndexWriter constructor.

new IndexWriter(FSDirectory, Analyzer, boolean);

The problem arises when two threads attempt to create the same index after simultaneously
finding that the index does not exist.  This problem can be reproduced in a single thread
by

writerA = new IndexWriter(new File("c:/import/test"), new StandardAnalyzer(), true);
writerB = new IndexWriter(new File("c:/import/test"), new StandardAnalyzer(), true);
add1000Docs(writerA);
add1000Docs(writerB);

this will throw an IOException

C:\import\test\_a.fnm (The system cannot find the file specified)

The only solution I can think of is to create a database/file lock to get around this, or
change the Lucene code to obtain a lock before creating an index.  Any ideas?

David








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


Mime
View raw message