This is likely happening because you're attempting to copy a file that
IndexWriter is currently writing?

You shouldn't do that (copy files that are still being written) --
that just wastes bytes (they aren't used by the index), and causes
this failure on Windows.

Instead, you should use SnapshotDeletionPolicy -- it tells you
specifically which files make up the latest commit point.  Those files
will not be opened for writing (only for reading, if you have an
IndexReader open on that commit) and they should copy just fine on
windows.

The "Hot backups with Lucene" article (NOTE: I'm the author) in
upcoming Lucene in Action 2 revision shows how to do this -- it's
available for download from http://manning.com/hatcher3.

Mike

On Thu, Feb 25, 2010 at 3:15 AM,  <luocan19826...@sohu.com> wrote:
> I want backup my index file,but I get the follow error.
> java.io.IOException:&nbsp;another program lock the file!&nbsp;at 
> java.io.FileInputStream.readBytes(Native Method)&nbsp;at 
> java.io.FileInputStream.read(Unknown Source)&nbsp;at 
> com.common.Utils.copyDirectory(Utils.java:149)&nbsp;at 
> com.common.Utils.copyDirectory(Utils.java:138)&nbsp;at 
> com.common.Utils.copyDirectory(Utils.java:138)&nbsp;at 
> com.index.IndexManager.backDataPolicy(IndexManager.java:398)&nbsp;at 
> com.index.IndexManager.indexLoop(IndexManager.java:222)&nbsp;at 
> com.Main$1.run(Main.java:48)&nbsp;at java.lang.Thread.run(Unknown Source)
> &nbsp;
> How can I backup lucene file in IR thread.

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

Reply via email to