You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dalton, Jeffery" <jd...@globalspec.com> on 2006/01/24 21:15:33 UTC

Optimize segment deletion exception

I have a class which uses the Lucene 1.9 (Jan 24th svn version)
IndexModifier to write documents, delete documents, etc...
Periodically, I have a scheduled task which uses this IndexModifier to
optimize the index.  I've been tracking down a problem/bug.  I can
re-produce it pretty consistently running my program.  I simply open an
IndexModifier wait, without adding documents, and then trying to
optimize. Doing this I sometimes get the following error:

java.io.IOException: Cannot delete C:\01570_01579\segments
	at
org.apache.lucene.store.FSDirectory.renameFile(FSDirectory.java:265)
	at
org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:95)
	at
org.apache.lucene.index.IndexWriter$4.doBody(IndexWriter.java:698)
	at org.apache.lucene.store.Lock$With.run(Lock.java:109)
	at
org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:702)
	at
org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:658)
	at
org.apache.lucene.index.IndexWriter.optimize(IndexWriter.java:517)
	at
org.apache.lucene.index.IndexModifier.optimize(IndexModifier.java:328)

I have seen this fail for an index repeated times in a row, although I
haven't tested to see if the same indices cause trouble across
restarting the program.

Re-reading this mailing list, I found the following bug report submitted
and patched by Luc (via Yonik):
http://issues.apache.org/jira/browse/LUCENE-481 regarding the
IndexReader on Dec 22nd.

After reading this, I upgraded to the latest Lucene source, which I got
from SVN today(Jan 24th).  This includes Luc's patch submitted on Dec
22nd.  The above error is from the latest, patched, code.  

I am running on Windows Server 2003, Web edition with the latest 1.4.2
Sun JDK.  This seems a bit bizarre, is there a windows platform problem?
When the IndexModifier closes the IndexReader, are some resources not
being released?  

The following code in FSDirectory is throwing the error:
if (nu.exists())
      if (!nu.delete())
        throw new IOException("Cannot delete " + nu);

Clearly, deleting the segs file is failing.  Another process (a reader?)
still has an open handle?  

I've got to get this fixed, so I'll do whatever is necessary.  Any known
issues or tips/assistance tracking this one down would be greatly
appreciated.  If there is any other information I can provide to
troubleshoot, I'll try and get it done.   I'm working on a test case to
try and see if I can isolate the problem.

Thanks,

- Jeff


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


Re: Optimize segment deletion exception

Posted by Daniel Naber <lu...@danielnaber.de>.
On Dienstag 24 Januar 2006 21:15, Dalton, Jeffery wrote:

> This seems a bit bizarre, is there a windows platform problem?

Yes, you cannot delete opened files on Windows. I'm not sure, but there 
might even be situations where files that have been closed cannot be 
deleted for some time. The mailing list archive contains several mentions 
of this problem.

Regards
 Daniel

-- 
http://www.danielnaber.de

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