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 lu...@sohu.com on 2010/02/10 10:24:38 UTC

problem:lucene did not delete old index file after optimize method called




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!!

Re: problem:lucene did not delete old index file after optimize method called

Posted by Michael McCandless <lu...@mikemccandless.com>.
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,  <lu...@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 .
> &nbsp;
> 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.
> &nbsp;
> ((after I restart my program, optimize index file disappear,but old index file stay))
> &nbsp;
> &nbsp;
>
>
>
> ----- 原文 ----- 发件人: 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, &lt;luocan19826164@sohu.com&gt; wrote:&gt;&gt;&gt;&gt;&gt; lucene did not delete old index file after optimize method called.&gt; ps:I call IndexWriter.getReader() and then call old IndexReader.close() every 1 minute,&gt; a long time pass, I watche old index file did not disappear.&gt; after I restart my program, optimize index file disappear,but old index file stay!!---------------------------------------------------------------------To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.orgFor additional commands, e-mail: java-user-help@lucene.apache.org

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


Re: problem:lucene did not delete old index file after optimize method called

Posted by lu...@sohu.com.
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 .
&nbsp;
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.
&nbsp;
((after I restart my program, optimize index file disappear,but old index file stay))
&nbsp;
&nbsp;



----- 原文 ----- 发件人: 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, &lt;luocan19826164@sohu.com&gt; wrote:&gt;&gt;&gt;&gt;&gt; lucene did not delete old index file after optimize method called.&gt; ps:I call IndexWriter.getReader() and then call old IndexReader.close() every 1 minute,&gt; a long time pass, I watche old index file did not disappear.&gt; after I restart my program, optimize index file disappear,but old index file stay!!---------------------------------------------------------------------To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.orgFor additional commands, e-mail: java-user-help@lucene.apache.org

Re: problem:lucene did not delete old index file after optimize method called

Posted by Michael McCandless <lu...@mikemccandless.com>.
This happens, on Windows, when there is an IndexReader still reading
those files.  IndexWriter will periodically (after a merge completes
or a new segment is flushed) retry deleting those files, but it won't
succeed until no reader has a given file open anymore.

IW also deletes unreferenced files when it's first opened.  So if you
want to force it to try to delete, close your current IW and open a
new one (with create=false).

Mike

On Wed, Feb 10, 2010 at 4:24 AM,  <lu...@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org