I don't think adding extensive locking is necessary. What you are probably experiencing is that you've closed the index before you're done using it. If you aren't careful to close the index only after all searches on it have been completed, you'll get an error like this.

Scott

[EMAIL PROTECTED] wrote:

Hello,

I'm trying to debug a problem with a lucene installation which is getting
"java.io.IOException: Bad file number" occasionally when performing
searches.  More specifically, the exception is coming when we are using a
Reader to extract the "hit" Documents from the index (due to using
getMessage instead of printStackTrace, I can't tell for sure if the
exception is coming from opening the reader, or getting the
document...arrgh!).

I believe this problem is because of our design, which is that we allow
ongoing multiple searches, and every 30 seconds we have a separate program
which performs updates (adding and deleting documents) on the same index
that is being searched.  After a batch of updates are performed we close
and re-open the IndexSearcher, the idea being that it should now be able to
access the new documents.

Is this a situation where we should have some locking in place that has
searches wait while documents are being added/deleted?  This would be easy
enough to implement, but there is a lot of updating to do, and we don't
want to sacrifice the excellent performance of the search by waiting every
30 seconds while updates happen.  We've thought of two basic paths to take:

1.  Implement a locking mechanism, and maybe try to add/delete one document
each time the updating program aquires the lock, instead of a bigger batch.
We think this might keep the search waiting the least amount of time, but
updates will take longer.

2.  Use a scheme with 2 indexes where we always update the one that isn't
being searched in, and switch between the two.  We are not sure if it makes
sense to perform the switch every 30 seconds in this case.

Does anyone have an idea if I am correct about the cause of the Exception,
or any thoughts on the two possible solutions?  We are running jdk 1.4, and
lucene 1.2 on solaris.

Thanks for any help you can give.

Brad Hendricks



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- Always drink upstream from the herd. - Will Rogers



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to