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 Sebastian Ho <se...@bii.a-star.edu.sg> on 2004/04/30 08:32:45 UTC

potential synchronization problem

Hi

I forsee the following scenario in my project and hope to get a reply to
this before I start coding :

I have an standalone application which runs lucene indexing in the
background at a user specified interval (e.g. every 2 days). In the
meantime, user will be able to force a indexing operation anytime he
wish to. I assume this will cause two process of lucene writing to the
same index files (one from the background lucene and the other one by
the user). Will this cause any problem with regards to race condition or
synchronization issues if any?

Thanks

Sebastian Ho
BII


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


Re: potential synchronization problem

Posted by Leos Literak <li...@centrum.cz>.
Otis Gospodnetic wrote:
> Yes.
> I suggest you devise a 'index request queue' mechanism to handle
> situations like this.  This can probably be made quite generic (i.e.
> not Lucene and not indexing specific).  How you go about implementing
> this is up to.

I handle this with script, which
1\ generates new index to temporary directory
2\ removes directory with old index
3\ renames temporary directory to standard location

unfortunatelly this doesn't garantee atomicity, so
I can find in logs exceptions, when user performed
search in 2\ or 3\ steps. Because step 1\ takes
ten minutes, while 2\ and 3\ several seconds at most,
I am happy with this solution.

Leos


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


Re: potential synchronization problem

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Yes.
I suggest you devise a 'index request queue' mechanism to handle
situations like this.  This can probably be made quite generic (i.e.
not Lucene and not indexing specific).  How you go about implementing
this is up to.

Otis


--- Sebastian Ho <se...@bii.a-star.edu.sg> wrote:
> Hi
> 
> I forsee the following scenario in my project and hope to get a reply
> to
> this before I start coding :
> 
> I have an standalone application which runs lucene indexing in the
> background at a user specified interval (e.g. every 2 days). In the
> meantime, user will be able to force a indexing operation anytime he
> wish to. I assume this will cause two process of lucene writing to
> the
> same index files (one from the background lucene and the other one by
> the user). Will this cause any problem with regards to race condition
> or
> synchronization issues if any?
> 
> Thanks
> 
> Sebastian Ho
> BII
> 
> 
> ---------------------------------------------------------------------
> 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