lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <karl.wet...@gmail.com>
Subject RE: Lock obtain timed out
Date Thu, 27 Jul 2006 07:25:17 GMT
On Thu, 2006-07-27 at 08:59 +0200, Björn Ekengren wrote:
> > > When I close my application containing index writers the
> > > lock files are left in the temp directory causing an "Lock obtain
> > > timed out" error upon the next restart.
> > 
> > My guess is that you keep a writer open even though there is no activity
> > involving adding new documents. Unless I have a massive never ending
> > stream of new data arriving (many thousand per minute) I usually try not
> > to have an open writer. Opening, adding documents and closing the writer
> > in iterations.
> 
> The application I'm writing is a server that keeps a reader and a
> writer open at all time. I realized last nigth this will not work
> since they both need a lock (reader when deleting and writer when
> adding) so I need a workaround. 

No offense, but your current solution is not viable. What you need is to
rewrite the code that handles your index, not a workaround. Or you could
wait for the new deleteDocument method in IndexWriter. Not sure when
that will be around though.

> Is it possible to temporarily let the reader release the lock so that
> the writer can add a document or do I need to close it and open it
> again when writer is finished ?

You release the lock by closing the reader... It is also possible to
plain old skip the creating of locks using -DdisableLuceneLocks=true,
but that might cause many other problems for you.

You are aware that no document will be deleted from the index until you
close the reader? If you keep a reader open at all times just for
deleting documents and never close it, they will not be deleted.

If you need to update lots of documents in your corpus (delete and add)
then first delete the documents with the reader, close it and add them
again with the writer. And then close the writer when you are done. And
don't open it again until you need to add documents again.


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


Mime
View raw message