lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <yahootintin-luc...@yahoo.com>
Subject Re: lucene file locking question
Date Fri, 12 Nov 2004 05:56:46 GMT
Disabling locking is only recommended for read-only indexes that
aren't being modified.  I think there is a comment in the code
about a good example of this being an index you read off of a
CD-ROM.

--- John Wang <john.wang@gmail.com> wrote:

> Hi folks:
> 
>       My application builds a super-index around the lucene
> index,
> e.g. stores some additional information outside of lucene.
> 
>        I am using my own locking outside of the lucene index
> via
> FileLock object in the jdk1.4 nio package.
> 
>        My code does the following:
> 
> FileLock lock=null;
> try{
>         lock=myLockFileChannel.lock();
> 
>         indexing into lucene;
> 
>         indexing additional information;
> 
> }
> 
> finally{
>       try{
>           commit lucene index by closing the IndexWriter
> instance.
>       }
>       finally{
>         if (lock!=null){
>            lock.release();
>         }
>       }
> }
> 
> 
> Now here is the weird thing, say I terminate the process in
> the middle
> of indexing, and run the program again, I would get a "Lock
> obtain
> time out" exception, as long as you delete the stale lock
> file, the
> index remains uncorrupted.
> 
> However, if I turn lucene file lock off since I have a lock
> outside it anyways, 
> (by doing: 
> static{
>     System.setProperty("disableLuceneLocks","true");
>   }
> )
> 
> and do the same thing. Instead I get an unrecoverable
> corrupted index.
> 
> Does lucene lock really guarentee index integrity under this
> kind of
> abuse or am I just getting lucky?
> If so, can someone shine some light on how?
> 
> Thanks in advance
> 
> -John
> 
>
---------------------------------------------------------------------
> 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


Mime
View raw message