My guess is there is accidentally still a reader open, at the time that IW tries to delete these unreferenced files.
Eg if you close & reopen your reader, always, then there is always a reader open on the index. Try closing all readers, then close IW, then open & close a new IW, and see if the files are deleted. Or... can you make this happen in a small test case? Mike On Wed, Feb 10, 2010 at 5:35 AM, <luocan19826...@sohu.com> wrote: > thanks for your reply! > but I don't think there is an IndexReader still reading those files,because I > call indexReader close > and reopen every 1 minute . > > IW also deletes unreferenced files,but why it delete the optimize file,not > delete the old index file. > the merged file is what I wanted. > > ((after I restart my program, optimize index file disappear,but old index > file stay)) > > > > > > ----- 原文 ----- 发件人: Michael McCandless 主 题: Re: problem:lucene did not delete > old index file after optimize method called时 间: 2010年2月10日 17:58:12 > This happens, on Windows, when there is an IndexReader still readingthose > files. IndexWriter will periodically (after a merge completesor a new segment > is flushed) retry deleting those files, but it won'tsucceed until no reader > has a given file open anymore.IW also deletes unreferenced files when it's > first opened. So if youwant to force it to try to delete, close your current > IW and open anew one (with create=false).MikeOn Wed, Feb 10, 2010 at 4:24 AM, > <luocan19826...@sohu.com> wrote:>>>>> lucene did not > delete old index file after optimize method called.> ps:I call > IndexWriter.getReader() and then call old IndexReader.close() every 1 > minute,> a long time pass, I watche old index file did not disappear.> > after I restart my program, optimize index file disappear,but old index file > stay!!---------------------------------------------------------------------To > unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.orgfor additional > commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org