lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Waiting for lock file problem
Date Fri, 15 May 2009 20:52:43 GMT
You should try to share a single IndexWriter instance across "Build
Indices" and "Application".  Also, you shouldn't open a new
IndexWriter for each document added (nor, call optimize), if possible.

Lucene doesn't allow more than one IndexWriter to be open at once on
the same index (the write lock enforces this).

Mike

On Fri, May 15, 2009 at 4:18 PM, Newman, Billy <Billy.Newman@itt.com> wrote:
> I am trying to build my indices file while still allowing my application to add new information
and I my application cannot obtain the lock.
>
> Here is a little pseudo code on what I am trying to do:
>
> Build Indicies:
>
> 1.       For each element (i.e. I have n elements I want to add to the index)
>
> 2.       Create IndexWriter (this gets the lock)
>
> 3.       Add document
>
> 4.       Optimize IndexWriter
>
> 5.       Close IndexWriter
>
> Application
>
> 1.       Application submits one new element
>
> 2.       Create IndexWriter (this gets the lock)
>
> 3.       Add document
>
> 4.       Optimize IndexWriter
>
> 5.       Close IndexWriter
>
> So again my problem is that the application cannot get the lock file while I am building
the index file.  I am sure that the writer in the build indices loop is closed after each
element is added therefore releasing the lock.  I have set the WRITE_LOCK_TIMEOUT to 10 seconds.
 I can see the build indices process close the writer many times over those 10 seconds, but
I see the application wait 10 seconds and timeout with a lock timeout exception.  The loop
in the build indices process is running very fast but I would guess that when the application
asks for the lock it should be able to see the lock free (even for just a short amount of
time) because it should be next in line.   Am I doing something fundamentally wrong here,
or is this a problem with the way lucene locks.
>
> Thanks,
> Billy
>
>
> ________________________________
> This e-mail and any files transmitted with it may be proprietary and are intended solely
for the use of the individual or entity to whom they are addressed. If you have received this
e-mail in error please notify the sender.
> Please note that any views or opinions presented in this e-mail are solely those of the
author and do not necessarily represent those of ITT Corporation. The recipient should check
this e-mail and any attachments for the presence of viruses. ITT accepts no liability for
any damage caused by any virus transmitted by this e-mail.
>

---------------------------------------------------------------------
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