lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wang <john.w...@gmail.com>
Subject lucene file locking question
Date Fri, 12 Nov 2004 02:21:55 GMT
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


Mime
View raw message